#help-with-radio
1 messages ยท Page 3 of 1
and our professor is making the pcb for us from the circuit diagram
and then coding the pico is probably the hardest part left
Look at schematics. Recieving continuous wave is at least kind of easy to recieve
Probably
probably not
frequency range is 25.2 --> 28.8MHz
we will broadcast those
3.6MHz wide
Rtl-sdr can recieve 25MHz I think
we have a weight limit of 200g
lol
its pretty small and tough to work with
I think we might manage to pull it off
its like 20 days
There are pre-made low noise amplifier boards, so that might simplify things. But you would probably have to do impedance matching into the mixer. I have no idea how to match impedance. There are calculators, but you have to know the load impedance. Maybe load impedance is the complex impedance of the biaser circuitry (the thing that acts inadvertently as a high pass filter).
Or does matching even matter when you really just want a high impedance load (the ADC) so you can get significant voltage from the tiny rf currents?
hmm, this isn't a bad idea at all actually
Very interesting
@grizzled vapor they all use coaxial cables though
You can technically desolder the sma connectors
I'm also not sure about all the impedance matching stuff
But I don't think it matters as much for recievers
I think its to connect the antenna to the circuit
@half plover or @primal warren Does impedance matching matter much for radio recievers?
That is what sma is for
interesting but still think I need impedance matching, if there are any other solutions then I'm all ears. I'd rather not have to impedance match
sounds like added complexity to me
my job on my team is basically managing the electronics, data analysis and general team
but I basically do anything needed
I'd be happy to not have to impedance match
If you are harvesting power. Definitely. Not sure about general reciever. A lot of fm recievers work fine with a random piece of wire attached.
I don't think impedance matching is massively hard actually
I'm just reading this
Although the dipole antenna from my rtl-sdr kit does not work with my baofeng radios (I can't get any signal even on strong FM stations).
oh
But maybe the rtl is just more sensitive
Yeah
Generally
How do you find the load impedance?
But in the case of No teaming/af's reciever, wouldn't you want the source impedance to be low and the load impedance to be high so the voltage is higher at the source-load node so the ADC can read the signal?
For an energy harvester like I'm doing, you definitely want maximum power transfer and efficiency
Impedance matching isn't that hard
But finding the source and load impedance might be if they're not given
yep
thats the tough part
There are likely antenna calculators, but I haven't seen anything for load impedance.
What is load impedance
I know about source impedance
isnt load impedance just the antenna's impedance?
oh wait what
But it's opposite for transmitter
I thought it was other way
do you need to match impedance in the transmitter?
I didn't think so
The power amp is source and antenna is load in transmitter
Yes. Otherwise you don't get complete power transfer.
ouch
How is a computer making 27MHz?
not hard
audacity
We managed to test it
we will test it again with a picoscope
in a week
Sound card cannot create 27MHz
I didn't mean that as a reply to that message
but audacity can create 27MHz
I would use si5351 clock generator. Or the Pico's internal clock.
You can create a clock out on some of the pico's pins
But Si5351 is more adjustable
In this article, weโll use Scilab to generate numerical signals that can be converted into analog waveforms by a computerโs audio hardware.
this seems to work
use the pico to create a waveform?
Well square wave
we need sine wave
You can't. Sound cards have a limited bandwidth since they are high resolution devices that are meant to create audio frequencies
You can use a crystal oscillator. Colpitts
My function generator can't go above 25MHz
You may not need sine wave
mmm I think we might
Look into quadrature demodulators. There are some that use flip flops to create a 90 degrees phase shifted square wave for the mixers
sine wave simplifies things
how do we create a variable waveform generator from 25-29MHz
thats what I need to find out
we dont have massive amounts of time
Use a high speed DAC
A variable waveform is tougher, but if you just need one frequency, you can generate a digital square wave and just pass it through a filter to turn it into a sine.
well we need a few
like
Or use max2606
maybe 3-4 frequencies
Or just make an adder
28MHz, 26MHz, maybe a 27.5MHz and a 26.5MHz
Make a 27MHz oscillator and sum it with whatever signal you want
those 4 frequencies
we have an oscillator
Ah different frequencies
That sounds like a job for the si5351
minimum 2 frequencies
28MHz and 26MHz
Those 2 at least
Si5351 then use filters to make it more sinusoidal
There might also be ways to play with the Pico's PLL and clock dividers to output some frequencies in that range. I don't have a great intuition for how fine of an adjustment you could get, though.
its pretty large
28MHz and 26MHz
why is this so hard!!!
Because engineering is hard
more Pico coding no no no no no
but what about a normal raspberry pi
because it is ground based apparatus
Si5351 clock gen
now that is a good shout
ok let me look at it
There is circuitpython support
Probably since it is an adafruit board
ok
I like this idea
is there a catch
do I have to setup some ungodly circuit
Not really. Just look at adafruit's schematics
hmm alright
that shouldn't take ridiculous amounts of work, but we only have 20 days for the whole project(19 actually before testing)
It is only 3v pk-pk out so you may want to lower that to the level of the rf signal coming in
I am stressing
isnt this a function generator
this creates a frequency?
But that should be easily accomplished with a voltage divider
It's a frequency gen
RF mixer doesnt care about voltages very much
its the ADC that craes
cares
Should be fine
well all voltages going into ADC need to be in between 0.36 and 1.56V from what I understand
I don't know how to do that either
also @grizzled vapor https://learn.adafruit.com/adafruit-si5351-clock-generator-breakout this output is a coaxial cable or somethin
It can be sma or it can be used with breadboard
Get the one with 3 outputs though
There may be some parasitic inductance concerns with the traces
I'm not sure how to handle that
I would just integrate the chip into my own pcb design
what?
yes
we will use breadboard and connect a raspberry pi 4
or a raspberry pi 3
Breadboards are not good for freqs above 10MHz
You need to use perfboard, bare copper board, or solder in midair
perfboard
oh yes
we have one of those
@grizzled vapor we have one of those
do they work for these high freqs
This seems easy enough
Probably
But maybe take care where you place your wires
Stuff gets funky at high freqs
too much funk
what does this mean? Not too close together?
I think you should have ground wires close to every high frequency thing to minimize inductance
spam ground wires
got it
And don't make wires too lose or dangly
does this apply to my receiver too? probably
Large loops are bad
yes
my receiver is a PCB though
I thought you were doing this for transmitter
we are talking about transmitter yes
transmitter --> perfboard, receiver --> PCB
On PCB parasitics should be easier to minimize
You need a power amplifier and some impedance matching for the transmitter
nooooooooo
And I have no clue how to design that
Look at QRP transmitters?
I have been working 5 hour days
and I'm dying inside
my brain is rotting
I am dreaming about yagi antennas
this isn't healthy
sorry, I started ranting
Its fine
I have 20 days
I've got this
....maybe
......possibly
....potentially
I need to make a list of everything to do
There are plenty of ham radio schematics out there that do CW at 30MHz. So that's good
Just copy one verbatim and see if it works
CW?
Or buy QRP kit
we will do like 2-4 frequencies
eh, options options
2-4 frequencies just needs more individual transmitters. Or you could integrate them into one thing with a mixer
Impedance matching on the receiver and transmitter(10/10)
Coding Rpi pico(9/10)
Yagi Antenna building(3/10)
Function generator building and transmitter supports/amplifier(8/10)
Finish circuit diagram completely(8/10)
what I have to do
well my team
with difficulty in brackets
surely with that clock chip you showed me
Si5.....
I just create separate programs
circuit remains the same
Electricity can be hard, but this is kinda how I learned. Maybe watch some videos to understand more of the theory
but in theory that clock chip thing works right
I'll consult more experts tmmrw
Yes
I'm not really an expert
I'll put in like a 5 hour shift tomorrow, I have maths exams too
I would disagree, you are sort of an expert
This is what I have for the "Insanity harvester V1"
that looks hard
also with this clock chip thing, does it produce a sine wave - I assume wave but better to check
@grizzled vapor adafruit shipping is 20 dollars cheapest
outrageous
actually its fine
we can just buy from amazon
I love amazon
I love Bezos
I have a whole bunch of questions that I wrote down about the harvester.
How should I design the impedance matching network? What should it match with?
you need to impedance match as well
I guess we are both in the mud, me more so
I figured out the ZMPPT setting. It turns out that you set the impedance it needs to match manually, and the IC will change its load impedance to be a certain value. So now I know load impedance. Source impedance should be 50 ohms since I'm using a standard rubber duck antenna. I just need to know the impedance of the multiplier. But I can fine-adjust the ZMPPT setting to get more of an impedance match.
Oh I see, this probably applies to my project too
We are just using some bog standard lightweight wire
As antenna wire
No. Only for the AEM30940
Oh.
Quarter Wavelength is 2.75m
We are just dangling it off the balloon
ig that works
What do you even connect the antenna wire to?
Maybe a thing you can do to know the load impedance is to have a resistor across the input and GND of the ADC
but Idk how dc blocking cap affects that
there must be a way to calculate it
ig you just take the resistance (50k) and add the capacitive reactance to get a complex impedance
Probably he's
the antenna wire goes to the input of the mixer. Since it's a dipole, the other one goes to GND
Yes I forgot that the other one has to go to ground
You can make a loop antenna or use coils in your dipole that make it electrically longer
Loop antennas are supposedly very efficient
Hm ok
@primal warren @granite spear @half plover @grizzled vapor I have a question about the circuit, doesn't the voltage divider add 1.65V(half Vcc) to every voltage coming it, but at the same time, the nominal values for the ADC are 0.36V and 1.56V, which means every voltage will be out of this nominal range. I feel like I am misunderstanding something. What does this voltage divider do exactly?
The voltage divider doesn't "add" voltage as much as set the baseline idle level
ok I see
However, normally yes, you'd center the idle voltage within the allowed input range of your ADC (which isn't Vcc/2 in this case)
but dont all voltages going into adc have to be in between the nominal values
Correct
yes, so i should centre it at 0.96V
meaning I should redo my voltage divider values?
Correct
thank you
Be prepared for other issues like this to crop up in the future. Us 'random people on the internet' are usually not carefully reading everything in the datasheet, so places where things differ from the typical behavior of similar parts can slip through...
who are random people?
๐
however, does this mean I will have to change the capacitor value as well?
the one going into the voltage divider
Theoretically, but the 3.3ยตF capacitor you currently show is SO LARGE that it just doesn't matter, unless you change the effective parallel resistor value by orders of magnitude.
I mean thats pretty good
https://www.amazon.co.uk/SI5351A-Clock-Generator-Breakout-Board/dp/B00SK8LNYG we are also using this for our function generator to create different frequencies
The Si5351A clock generator breakout from Adafruit allows you to generate any clock frequency from 8Khz up to 160MHz. The clock generator is an I2C controlled. It uses the onboard precision clock to drive multiple PLL's and clock dividers using I2C instructions. By setting up the PLL and dividers...
this works right?
I'd probably buy it from a reputable reseller, and you may need some shaping circuitry to avoid harmonics/birdies, but if it covers the specific frequencies you need, it should presumably do the job.
It is coming from adafruit/amazon
shaping circuitry, birdies, harmonics, this is all alien to me
Amazon has a bad habit of selling counterfeit knockoffs, which can cause all sorts of unexpected problems if they don't behave quite like the genuine units.
hmm
What a mixer does is when you input two frequencies, it will output the sum and difference frequencies. Normally you filter out the one you don't want and feed the other to you digitizer.
However, I think that clock generator doesn't produce a harmonic free pure sine wave but a square(ish) wave, which includes several additional harmonic frequencies. When you feed all that into a mixer, you get a whole zoo of assorted sums, differences, etc., which can confuse your digitizer if they're not filtered out (either before or after the mixer)
oh no
is there a clock generator that does produce it harmonic free
Something like an AD9837 or AD9833 might do the job. Unfortunately, I'm not too familiar with the Si5351, so I'm unsure what it produces as output.
right
Even those fancy chips produce harmonics, but they intentionally push the harmonics far from the fundamental frequency, so they're easy to remove with a simple low-pass filter.
hmm right
I was playing with an AD9833 chip recently, here is the nice sine wave output it produces
so a simple low-pass would get rid of it
thats pretty nice, also, you have your own oscilloscope?
Yes, I find an oscilloscope quite useful for working with circuitry
@primal warren for these chips you need an SDP controller board though don't you?
and how do you code them?
also they are very expensive
uh oh
@primal warren are there any other ways to generate different frequencies between 25 and 28MHz
Another method might be something like a max2606 could work
You would just need a few
control them with a dac to tune the frequency
you can get i2c dac
you select the inductor for each one to be around the freq you want, then you use dac to fine-tune
Yes. Lots of them. We've discussed this before.
max2606 is reasonably simple
I think we are buying a premade function generator in the ยฃ100-200 range
as it will be easier
The AD9833 boards aren't expensive. The ones I picked up on eBay were only $9 apiece, and there are cheaper ones out there.
another option is crystal oscillator (colpitts). More stable and predictable, but cannot be adjusted easily
Normally crystal oscillators are Pierce oscillators (Colpitts are normally LC oscillators)
ok that's what I meant then
it's similar to colpitts
AD9833 looks like a good option
much better than buying a whole function generator
Yeah, oscillator classification is not an exact science (the more unusual ones like electron coupled oscillators, Clapp oscillators, SAW oscillators, phase shift oscillators, blocking oscillators, etc. all have their place too).
The most crazy oscillaors are the ones with only 1 or 2 components
You could build a simple inverter-based crystal oscillator and switch crystals for the specific frequencies desired. That is a pretty minimal approach.
they use some weird non-linear negative resistance to make relaxation oscillators
you have to code that dont you?
like neon bulb oscillators
with only 20 days left I think we will just use a premade one
Weirdly, the electronic organ I'm repairing uses strange oscillators that are a combination of Hartley and Colpitts, and then uses neon bulb oscillators as frequency dividers synched with the main oscillators. It's a trip.
you do have to do some code, but there are libraries written for it
Gunn diodes are trippy
I used a canned library and an Arduino to control the AD9833, it took me less than half an hour.
so are other reverse biased "diode" oscillators
They do work over SPI, which requires more pins than i2c
but your pico/pi should have enough
If you aren't using the SPI bus for anything else, and you don't need to read back any data, it's the same number of pins (2) as I2C
If there's only one device, you can tie CS to active.
yes
but I think he needs multiple for mixing and things
The AD8933 is a really cool IC
definitely using it if I build a radio
The AD9837 is similar, but a higher range of frequencies
nice
@primal warren we will get something premade like this
seems alright
Hello, im using adafruit 32u4 radioboard and I keep getting this error message when trying to upload basic RX example code:
Connecting to programmer: .
Found programmer: Id = "CATERIN"; type = S
Software Version = 1.0; No Hardware Version given.
Programmer supports auto addr increment.
Programmer supports buffered memory access with buffersize=128 bytes.
Programmer supports the following devices:
Device code: 0x44
any ideas?
we also keep finding that when we attempt to upload the code to the board, the board keeps disconnecting per the status in the bottom right of the arduino IDE:
I'm confused, the M0 is one CPU (a SAMD21) and the 32U4 is a different CPU (an AVR)
How would I find the impedance of a voltage multiplier?
Is there a seperate input and output impedance like a matching network? Or is it basically a series impedance?
A voltage multiplier is a kind of non-linear impedance, so it's hard to model
How would I model one at 80~100MHz?
I'm unsure why you would want to
I'm trying to harvest energy from broadcast FM, and I need to optimize the power transfer. Of course this is only if it is possible.
While it seems intuitively like you'd want to match impedances for maximum power transfer, in most cases, you want to optimize for max voltage (instead of power), as the main loss mechanism is forward drop in the diodes: the more voltage, the smaller percentage you'll waste in diode drops. At least that's the model I used for my harvester.
That's good to know
So that means antenna source impedance is more than multiplier impedance
If you manage 70mV (which is rather high for an antenna signal) and the diodes drop 65mV, you'll get 5mV of it. But if you can eke out 100mV, then you'd have 35mV after the diode drop.
Yeah, higher impedance generally equates to higher voltages and lower currents, which (I'm guessing) is going to be the winning approach
This is a napkinCAD sketch of the system
If the whole rf harvesting thing fails, I can just power the system off of a AA battery. The input of the AEM30940 I'm using can go down to 50mV, so that battery will last a long time
Here's my harvester in operation. The antenna is held near a WiFi router antenna by the alligator clip (I'm harvesting 2.4GHz WiFi here). The trace on the oscilloscope shows the voltage on the storage capacitor, once it gets up to a little voltage, the harvester chip empties the capacitor, leading to the sawtooth-ish waveform with the diagonal part the charging bit, and the vertical drop the harvester chip grabbing the charge out of the capacitor once it's high enough.
It's one of the TI ones, BQ something or other maybe? Let me see if I can find it.
BQ25560 "Nano Power Boost Charger and Buck Converter for Energy Harvester Powered Applications". Note the scales on the trace: 20mV/division vertical, so the capacitor is getting up to about 60mV before the chip discharges it, and 1s/division horizontal, so it's taking about 4 seconds to charge the capacitor to 60mV
It seems that harvesters are much more sensitive and efficient at lower frequencies, so I might be able to get a significant amount of power out of power out of broadcast FM. I have gotten about 10mV pk-pk on my oscilloscope using nothing but a probe (and the scope's bandwidth is only 70MHz). So maybe I can get something? Maybe I'll have to stick a big dipole or directional antenna on it or something.
A more efficient antenna will get you a lot more signal, and you can run the antenna into something like a 1:9 balun to raise the impedance and voltage. However, the only time I was able to get anything like a "significant" amount of power was when a cell phone was operating nearby. Those things really soak the environment in RF energy (if you've ever heard the staccato bleedover into a sound system, you know what I mean)
An interesting article on the subject, but a bit thin on details https://arstechnica.com/gadgets/2015/09/freevolt-perpetual-free-rf-energy-harvesting-to-power-the-internet-of-things/
Another thing that might be useful is "rectennas" https://www.intechopen.com/chapters/69576
Maybe I can use the capacitive coupling from 60Hz AC lines to power the harvester if the RF harvesting doesn't work.
You can often grab a fair amount of energy that way. Inductive coupling can work too if you have room for a largish loop (or better yet, a few turns) of wire
Oh, I mistyped that chip number, it's bq25570
FM broadcast stations are like several tens of kilowatts. So I was thinking I could get some decent power. If you're able to get energy from a wifi source and Samsung was able to get enough wifi energy to charge their remote, then it is possible I guess.
Oh yes, if you happen to be near a radio transmitter, cell tower, high tension line, etc., it's a lot easier. But a depressingly small distance away gets you down into microvolts.
I wonder if using synchronous rectifiers/ideal diodes in the multiplier would work. I could use the charge stored in the supercapacitor to power them.
It would require some initial charge to get going, but still would be useful and cool
It's possible: once the thing is bootstrapped, you can sidestep some of those losses, if your control circuitry is efficient enough.
Yeah driving the ideal diodes would get extremely complicated and expensive fast
The TI chip does this as well as using an input inductor as a voltage booster
The aem30940 has a similar input boost inductor
While there were chips with even lower input voltage requirements available when I was playing with this (a few years back), they were thermal harvesters that used things like 1:200 transformers on their inputs to boost the voltage. Since I didn't have a low-enough impedance source for that trick, I opted for this ideal rectifier / boost converter chip instead.
The balun is a good idea.
I'll almost definitely try it
But impedance matching will be a pain since I might be changing the circuit to optimize things and I would have to change the matching network for those things. I don't have a whole bunch of SMD RF inductors and caps on hand, and I don't really want to buy them.
I found a handful of chips that needed 200-400mV to get started, I wonder if there are some lower voltage ones available these days
Oh, I'd probably just use a binocular ferrite and a few turns of wire for the balun
The one I found can cold start at 380mv and go down to 50
It is a $7 IC though, so it's expensive. But not as expensive as some other options
Another last-ditch effort would be to use one of those tiny calculator solar cells
Things like this, they're easy to make and surprisingly effective
This is honestly my first foray into RF engineering
Yeah, that TI IC isn't cheap. The project I was using it for had an investor bankrolling things, which changed the parameters I was optimizing for.
There are RF energy harvester modules that are like $40 on mouser
$7 is cheap compared to that
How would I impedance match/optimize for 60hz mains through capacitive coupling?
I guess I just need a big ground and a big reciever.
Yeah, for capacitive coupling, you'd probably want some sort of ground reference
Well, that's an ideal voltage multiplier
It seems to me you'd need some really low threshold MOSFETs to make that work
True
It also seems you'd use up a lot of the RF energy charging and discharging the gate capacitances
@primal warren what capacitors did you use in your harvester? I'm thinking 10-50nF will work for mine
I think mine were fairly small value C0G ceramic, probably 100-1000pF or so. I'll see if I have any notes.
Looks like even less: 1284-1283-1-ND CAP CER 1.5PF 500V NP0 1111 or 1284-1274-1-ND CAP CER 10PF 500V 5% NP0 1111
1.5pF. I guess 10pF to 1nF will work well on my design
Beginner here, just had a GMRS radio installed in my truck. I'm able to listen in, but I tried transmitting a few times and no one responded. Assuming they weren't ignoring me ๐ , does this mean they were either using privacy codes or on a separate repeater channel? It's a Midland MXT275 with a ghost antenna
They may have been using CTCSS or something
that's what I figured
Would there be a way to modify these so that they can transmit/recieve on 915MHz instead of 433?
You'd probably have to adjust the matching network
There isn't. SX1278 only supports 137-525MHz
Heh, those aren't going any 5km with those antennรฆ anyway
Ah, I didn't realize the chips were different too
Probably not. Just looking for cheap lora transmitters
Interesting how the listing mentions SX1278 and SX1276, but it is a site notorious for counterfeit and mislisted junk
I was thinking that there would be a resistor that would just need to be changed or bodged to change the freq but no. And even if that were possible, I would still need to change the matching network
A lot of low power matching networks seem to be really simple. Just an inductor and a capacitor (some have more). But then why is this matching/whatever it is network so complicated? Is it because this HT radio needs to push out 10W of RF power and different matching networks are needed?
Also says "wireless power mental module" whatever that means lol
It's nowhere near 10W, but reflected energy can damage the transmitter, so a simple L or pi network normally suffices to transform the impedance at the feedpoint as needed for a frequency band.
Or are you referring to the one in that pic, which looks like possibly a cell phone or HT or something?
I'm referring to the one in the pic. It's the RF magic portion of a Baofeng BF-H6
Interesting, I guess I'll also use an L network then.
Our transmitter has to go approximately 200-250km but it helps that our frequency is quite low at around 27MHz
We are using a yagi antenna though with several booms and mounting it up to like 15 feet and putting around 30-50 Watts through it
@primal warren do you know if a UK CEPT license applies to other countries like Belgium as well?
Yes, it looks like there's a T/R 61-01 rule allowing temporary usage among all the CEPT countries if you have a license in one of them, and Belgium's a member. If you're there longer than 3 months, they want you to get a real local license, though.
do you know how to get a license, we revamped the projec
project
Afraid not, I've not gone through that process even in the US, let alone the UK, but I'd be worried that it might not be particularly quick if it's anything like other government bureaucracy.
Yes, those will tend to be more intricate, as they have to obey laws about harmonic radiation, so they're filters as well as matching networks.
oh yeah here are some updates, @primal warren @granite spear we decided to scrap the idea of the ADC and the mixer as well as local oscillator, so the only circuitry remaining is the Raspberry Pi(now a 3B+ not a pico), a band pass filter and a balun for impedance matching. We found a $35 dongle that attaches to a raspberry pi and acts as a spectrum analyzer, the only parts that remain challenging now are 1. Getting license for transmission and 2. The coding of the Raspberry Pi 3b+ to store the data rather than outputting it to a computer screen/monitor as a series of images.
because the dongle looks like it outputs some images to the screen as a spectrum analyzer and runs its own FFT, we need to save this in some way as we cannot see that data until the balloon comes back to ground
Excellent, the use of an SDR dongle seems like a good approach given the short timescale.
mhmm, the output from the USB is 'IQ' samples
I wonder how to save that
It shouldn't be massively hard
yeah, I think so
IQ samples looks like something I could just FFT or use the inbuilt FFT
That's quadrature demodulation ("I" is "in-phase" and "Q" is "quadrature"). If you don't need the phase information, you can just store the "I" channel. If you do need phase, store both of them.
right I see
the datasheet is quite small
It looks like it's using the same chipset as the RTL-SDR project, so a lot of the software tools you find for that will probably work with this one too.
hmm alright, I mean, how would I save these samples to run the FFT or whatever inbuilt software it has, I mean I'm probably going to run both my fourier and its fourier
just to see if the data coincides
@primal warren if you could assist, that would be much appreciated too. It looks like most of these RTL-SDR dongles use something like GQRX to operate which shows the frequency, thing is, since its on a balloon, I can't exactly capture any of this visually, so how would i save it as raw numbers or some sort of data form that allows me to analyse it later.
I'm not sure offhand. The dongle is just providing the samples to the Pi, so saving the data would be up to whatever app is receiving them. But somewhere there must be a command-line tool to just save everything to a file.
hmmm I see this, which seems interesting.
Not much to it, just read the data and stream it to a file.
what is the 'read the data' part
how does one do that
I know it isnt that complicated but I'm not sure how to read the IQ samples and store them
Here are some command-line tools to capture data to a file: https://wiki.archlinux.org/title/RTL-SDR
I'm sure there are more of these -- it's a matter of doing the right websearches
The AdaFruit page on a similar product has a bunch of useful links https://www.adafruit.com/product/1497
@young cove aha, merci beaucoup
There's also a wiki here https://osmocom.org/projects/rtl-sdr/wiki
Thing is I need to do this on a balloon remotely
So its not as simple as a command line tool
you can make a batch job that runs the command-line toosl
I cant type
Now this is very interesting
I cant type on the balloon I mean
It has to be remote
also see the pyrtlsdr
Alright
right, but a program is a program, whether it's a shell script or a python program or a c program
So I can make a 'batch job' that runs a shell script
you were going to need that anyway to run whatever program. look up cron and at
Or just a script that runs when you start the system.
if you find a linux sysadmin kind of person, they will know exactly how to do this
i thought you didnt' have the power budget for the Pi 3B+
you might want a cron job to monitor that the software is still running, and restart it if it is not
it's probably obvious, but run Raspberry Pi OS Lite, so you don't have all the baggage of a desktop system
We will use a pi 3
3b
So it's 260mA
Although even that is a lot
Ouch
Max was 200mA but we will apply for a waiver
@young cove does a pi zero suffice or any other sort of pi?
This is looking like too much current draw
you can turn off the wifi, not sure if 260ma is with the wifi on
I forgot about that
also you may be able to underclock it to reduce the power draw. Pi Zero would probably be fine too, but you need an OTG cable: a tiny bit trickier
We need to get this power down as much as possible
OTG cable?
Tiny bit....weight isn't that much of a problem
The pi zero requires a lot of current too
https://www.jeffgeerling.com/blogs/jeff-geerling/raspberry-pi-zero-power interesting table down the page, and see "Further reading"
This looks promising
A pi 3b+ drawing 0.35A
That means a simpler 3b might only draw around 0.25A
you should measure the power draw, and look at all these tips for lowering the power. maybe you can find an older A+ model as well. I'm sure there's another chart somewhere for power draws. You need to use your Google Fu.
You find stuff so quickly, thanks so much
I don't doubt it, although the official pi website says you need a 2.5A cable, although I assume that's only for connecting to a monitor screen
We do need USB though for the dongle
I'll see the least powerful pi that will be suitable
I think it's more than that. And that SDR is 330mA.
What's the least powerful thing we could use with that SDR
We will have to apply for a waiver either way
If we can get a pi with between 170-250mA that would be nice
Thanks, I think we will use the Pi zero 2w, carry our own power supply. Do you know is the pi zero 2w uses python or not. Or does this program to collect data even require python?
I think so but I don't know if it is fast enough
it can use python -- it's like any other RPi -- it runs Linux. The Python library above is a wrapper around a C library. I don't think it will be an issue.
You have simplified the system so much -- you will have time to try things out. You don't need a Zero 2W if you dn't need wifi
You may be able to mitigate the power because you're only taking data intermittently. Burn 1A for a second to take data and record it to the SD Card, then deep-sleep for 5 minutes, etc. The average power might be much lower than the peak.
noob question. What is the difference in these? Or better question is why would I pick one over the other? I know I want the Lora 900mhz but being new to microcontrollers in general and just discovered Adafruit I'm lost on the 'Feather' terminology.
Feather means that it fits a particular pattern for header pins. 16 on the left side, 12 in the right. Itโs guaranteed to work with any microcontroller host that is designed following the feather standard
Thank you for explaining that. Does that mean it will fit an Arduino Nano?
A nano is 5V logic so you would likely need some kind of level shifting
Highly recommend using something like the Feather RP2040
I'll look into that product.
The RP2040 is incredibly well documented, has tons of RAM and storage on the feather compared to the nano which is just a 5V 8-bit AVR board.
I just got my VS Code setup to develop for my Nano. Do you know if I can use VS Code for the RP2040?
You can, the RP2040 also means you can use circuitpython which should have a VS Code extension
ok I'm going to purchase the 2040 also and see what I can do
Is CircuitPython more powerful than using the cpp files?
No, but it can be easier to prototype what youโre trying to do
ok, I'll brush up on my python ๐ I'm mostly a C# person by day.
PlatformIO should allow you to add the RP2040 Arduino cores available for Arduino based development if thatโs your preference
All the boards Adafruit manufactures has learn guides with usually both Arduino and CircuitPython examples too
Excellent that gives me a good starting place. I have PlatformIO setup for my Nano via VS Code. But I'm really liking what I'm seeing over at AdaFruit even thought I'm an infant in microcontroller knowledge.
We all start somewhere ๐
Plus I've fallen victim to buying garbage on Amazon for my nano that doesn't work.
There are two main channels that will be helpful for you in your journey here #help-with-circuitpython and #help-with-arduino
There are usually a few people keeping an eye on those channels that will help when they are able to or have an idea of how to help
Excellent. Thank you for the info.
I say โa fewโ but itโs probably close to a dozen
Yeah, definitely!
Wherever you start, thereโs always someone here whoโs been there that can help ๐
Awesome. Is there a Veterans discount code for checkout?
I donโt believe so
ok
If you time your purchases right, Adafruit sometimes does discount codes like on Wednesday nights during ask an engineer
Usually you can save a few bucks
can you do C?
Would this be a good general topology for a simple SDR? It would probably work over a soundcard first (since I can use stereo channels for I and Q signals), but I might move it up to using ADCs and DACs that have a higher sample rate. It is an ambitious (actually maybe not since it's only a few ICs and there is open software available (can you direct me on any (especially for the transmit section)?)) project, so it may not make it far past the sketch phase. Would be really cool to make even just the reciever section. It's based off a hackaday article and QRP labs' QDX.
I can read C but writing in C is a challenge for me.
@primal birch is sitting at the desk tapping his fingers, waiting for his fun package to arrive from Adafruit ๐
@granite spear I've got the pi zero, an adapter to connect the dongle and a mini-hdmi to hdmi cable so should I just connect pi to monitor and install software on it(NOOBS) and then try making the pi zero receiver FM radio?
I've got an antenna connected to the RTL-SDR dongle
The Zero might be a bit slow for SDR but you can try! FM and HD radio (in the US) with an RTL-SDR on a Pi 3b worked great
Yep, that sounds like a good next step.
ok, thats fine, so 3B and 3B+ are fine then right?
Yep! I think I used gnuradio at the time to test it and it worked quite well
Well I need it to receive without being plugged in and just save data to a file rather than outputting it to a screen
so some coding will have to be done
I will have to use command line or something
I'm not sure yet
Not sure what kind of runtime you'll get from a battery- it's pretty resource-intensive during decoding
its only going to be on for 5ms every 3 minutes
so barely any power being drawn
Oh nice! You can certainly try it with a Zero and see what kind of results you get- IIRC it didn't take too long to set it up and test it
fair enough
mmm I forgot to ask this @young cove @granite spear Since I cant control the pi remotely, can I code this in python or do I have to use command line tools or something?
You'll need to do a minimal amount of command-line stuff to have it automatically run something after booting, but you can tell it to run a Python script for example and have most of your logic in there if you want.
oh fine
so the command line stuff is just basically to run the script after booting
fair enough
I'm trying to get the pi working right now
I need some long cable
my pi booted up
at least
ok col
@granite spear @primal warren so I've got gqrx working with the dongle and everything
now how do I save this stuff to a file
instead of outputting to my screen
echo data >> datafile.txt
what?
Works with gqrx
but currently it is outputting IQ samples to gqrx
rather than saving like data to a file
it is in visual form
Ah sorry thought maybe you were getting command line data ignore what I said
nope not yet
I mentioned previously:
Here are some command-line tools to capture data to a file: https://wiki.archlinux.org/title/RTL-SDR
and the library
https://pypi.org/project/pyrtlsdr/
and I'm sure there are more. You are not the first person with this use case
I would like to think I am
but of course not
Thank you very much
I will look into it
mmm @young cove @granite spear I can get the data using pyrtlsdr but thing is when I save it to a file, it saves as like dodgy symbols and says it cant be read as utf-8. I'm not sure what the problem is here. Do you have any ideas?
it's binary data, isn't it?
I would guess it's not text
to process it, you'll need to read it as binary data
it comes up as random symbols
the data format is described somewhere. You can use stuff like struct.unpack to parse it.
have to worry about byte order, is it floats vs ints, etc. are there there describing headers, etc.
I have absolutely 0 clue
it will be described in the pyrtlsdr documentation, or it will point to something that describes it
ok thanks
Could I use numpy and its load() function
and the allow_pickle part
I don't know, it depends on the format. Did you find info about the format?
Do you have a pointer to your program that's using pyrtlsdr? Are you using read_samples()?
so if you are using read_samples, it can return a numpy.ndarray(). You can use a numpy function to write that to a file (maybe you are doing that already), and use another numpy function to read that file. Looks like the samples are complex numbers. numpy can wrote that out efficiently as binary data. It can also write it in human readable form, but that takes longer.
Apologies if sent to wrong channel.
I'm trying to figure out if I can use a Huzzah32 Feather as a wifi coprocessor (like the airlift boards). Same chip if I understand correctly. Is it only a matter of flashing the airlift firmware?
@unkempt hearth The pin numbers get a little confusing, but yes you can. You can't stack two microcontrollers though, or put them on a doubler, they'll need to be explicitly wired together with just the necessary pins.
Yes I'm using that and struggling on how to unpack it as I'm getting UTF-8 errors and when opening the file in UTF-16, it comes out as a mess of symbols.
maybe I just convert to decimal or something before actually writing to a file
It's just binary data, not UTF encoded text
it would help if you posted the code or at least some fragments.
you need to open binary files in binary mode
I cant even open the file, I dont know how to unpack it
exactly, what even is binary mode
text mode treats newlines and related characters specially, and deals with multi-byte characters (e.g. UTF-8 encoding). binary mode is just a stream of raw bytes
how does one access binary mode
there are functions in numpy to read and write ndarrays
I see
you don't even need to open the file yourself, it should handle it. To use binary mode, you add a "b" to the mode: open("some.file", "rb")
I see
but aren't you using the numpy functions for file i/o?
yep
assuming you wnat to process the data in numpy
we really need to see some code that isn't working
you can upload a file with the + on the left
sure, once I have access to my monitor(5pm GMT) I will definitely send it
actually I can send it now
one second
show how you write the files in your pyrtlsdr code, and how you read them in the analysis program
sure
text is much better than screenshots
from rtlsdr import RtlSdr
sdr = RtlSdr()
sdr.sample_rate = 2.048e6 # Hz
sdr.center_freq = 28e6 # Hz
sdr.freq_correction = 60 # PPM
sdr.gain = 'auto'
f = open("results.txt", "wb")
f.write(sdr.readsamples(1000))
f.close()
f = open("demofile2.txt", "wb")
print(f.read())
I just made this up on the spot from memory
see #welcome for how to paste code
yeah, don't use f.write, use the numpy functions to write ndarrays
from rtlsdr import RtlSdr
sdr = RtlSdr()
sdr.sample_rate = 2.048e6 # Hz
sdr.center_freq = 28e6 # Hz
sdr.freq_correction = 60 # PPM
sdr.gain = 'auto'
f = open("results.txt", "wb")
f.write(sdr.readsamples(1000))
f.close()
f = open("demofile2.txt", "wb")
print(f.read())
wait I mistyped file names
from rtlsdr import RtlSdr
sdr = RtlSdr()
sdr.sample_rate = 2.048e6 # Hz
sdr.center_freq = 28e6 # Hz
sdr.freq_correction = 60 # PPM
sdr.gain = 'auto'
f = open("results.txt", "wb")
f.write(sdr.read_samples(1000))
f.close()
f = open("results.txt", "wb")
print(f.read())
@young cove so create an np.array()
and append to that?
readsamples returns an ndarray
Yes
if numpy is present, it says in the pyrtlsdr documentation. is numpy installed on the Pi
numpy.savetxt() and numpy.loadtxt() read and write text-format files. numpy.save() and numpy.load() use binary, which will be more compact
I think I tried numpy.load() but will try again
thanks a lot!
will come back after testing it.
you have to use numpy.save to save in a format numpy.load() needs. THere are many tutorials online about this. I may have some names slightly wrong, but that is what I see.
fingers crossed I've managed to get this working by my raspberry pi keeps on freezing up after running the code
HAHA IT WORKS
completely random @granite spear, would you like to try an electronics problem, my brain isnt working
Ive been trying but cant find voltage drop across R3
its crazy because my brain has been broken
you probably want to think of each resistor as having its own current. they sum to zero at the node Vx. V1, V2, and V3 appear to be fixed, according to the problem statement, so calculate what some of the currents are, and that should give you enough information to calculate the rest
yes
they are fixed
you dont know what the current is
you want to find voltage not current
wait a second
right, that's the ultimate goal. calculating the currents is a probably necessary step
yes
in the general case, the currents through each resistor will not be equal, as you seem to have written with "IRn" with no number on the I
of course
but for calculating Vx
I will need a resistance
what is the resistance at Vx
there is no such thing as the resistance of a node
i can find currents in terms of Vs and Rs
I know
but I can find current easily
but for V=IR you require a resistance
what is Vx in terms of V2?
well you only know current coming in from V2
you're not given I, though, are you? only V1, V2, and V3, along with the associated resistances?
yes but you can work out the 3 different Is
Like current from V1 = V1/R1
right, so calculate each I, and then you can calculate Vx from one of the other voltages
ok so you have V1/R1, V2/R2, V3/R3
thats trivial
no, it's not. it's actually I1=(V1-Vx)/R1
oh because its a potential difference
find
but same applies for each one then
Yup. Then I1+I2+I3 = 0, set up simultaneous equations et voilร
you might want to label each resistor with + and - ends so you can define the polarity of the voltages and currents
Ohm's Law gives you the other 3 equations
you don't have to do the nasty linear algebra thing because manual substitution is straightforward here
hmmm
you have V=IR for each resistor. that's 3 equations
we have covered I = V/R
yes
V = IR just yields V1 = I1*R1 which leads you back to where you where
or V1 in terms of V2
and things like that
my brain is failing to work
no, you're given 3 voltages and 3 resistances
yes
so I found the 3 equations
you need 4 equations because Vx is the fourth unknown. I1, I2, I3 are trivial. yeah, that's the current summation equation with the individual currents substituted in
my brain is blowing up
that's actually the substituted equation for I1 + I2 + I3 = 0, so it's already all 4 equations combined, because the substitution is easy to do manually (and you did it intuitively without thinking of it as 4 separate equations)
It's easier if you learn it when you're young
I am young-ish
My situation was a little odd: my mom was a math teacher, so she'd just tell me how to do algebra. The fact that I was 4 years old didn't matter to her, so I could rearrange equations, solve for unknowns, all that stuff before I started pre-kindergarten. Imagine my surprise when I started "school", and they tried to teach me about the number line! I got in big trouble for trying to explain negative numbers to the "teacher".
so you were a child genius?
Heโs an every day genius honestly. Very knowledgeable in many many fields
Indeed
I don't know about that, I just think young minds can absorb all kinds of things, but it doesn't occur to most people to explain algebra to 4 year olds.
I see, by the way, thanks to you, edkeyes, Danh, argon, Skerr and several others, I've got the pi working and everything working basically. Now just need to get it to run the script without my inputs but rathe do it straight after booting up.
My lamp is holding the dipole antenna up
hey. i'm having trouble with the bluefruit LE UART and RP2040 QT PY
i'm using the neopixel example
and i'm getting the following error :
'BLUEFRUIT_HWSERIAL_NAME' was not declared in this scope
i'm not sure how to interpret that
am i missing something
It looks like it's intending to have you define/replace that string with the name of the serial port you're using to connect to the Bluefruit with, which in Arduino land would be something like Serial or Serial1, etc. Does the example code have a commented-out line referencing it?
Adafruit_BluefruitLE_UART ble(BLUEFRUIT_HWSERIAL_NAME, BLUEFRUIT_UART_MODE_PIN);
// HARDWARE UART SETTINGS
// ----------------------------------------------------------------------------------------------
// The following macros declare the HW serial port you are using. Uncomment
// this line if you are connecting the BLE to Leonardo/Micro or Flora
// ----------------------------------------------------------------------------------------------
#ifdef Serial1 // this makes it not complain on compilation if there's no Serial1
#define BLUEFRUIT_HWSERIAL_NAME Serial1
#endif
@granite spear this is all i got
So I guess the question is, what serial port on the QT PY are you using to connect to it?
so looking at this
i'm guessing it's UART1
but if type in UART1 it doesn't work
So my guess is that there's so few pins on the QT PY that it doesn't set up UART1 by default since it doesn't know whether you want to use those pins for serial or I2C or something else. However, I don't know what the correct SERCOM incantation would be to configure that, I'm afraid. You may want to ask in #help-with-arduino.
It's beautiful, thanks for helping me guys. May still need some help on command line stuff tho
I just received my RFM95W and it came with a small piece of paper with what looks like an address on it. Can someone enlighten me?
That's a MAC address, the hardware ID or address of that modem. It can be used to comminicate with a specific device, or if asked for that when signing something up. Sorry not a LORA person yet, but I think of that like a bluetooth MAC address, or wifi MAC address, but LoRa
It can be used as a device id but it is not critical. In most cases I have needed one I was just able to generate one as needed. I have a drawer full of those slips and have never needed them.
I really hoped I was done
@young cove @granite spear I am sorry to bother both of you for the 100000th time. I have all the data and everything. But when I run my FFT on it, I get very different results from GQRX which is the main RTL-SDR dongle reader and analysis tool. Is there anyway I could upload my data to GQRX???
It also produces a really nice waterfall and basically all round great data
I'm not sure offhand. It wouldn't surprise me if GQRX has a method of loading data files to analyze, but I don't know what file format it might expect.
mhmm, thats the aim
I want to load in some data file with the data, but right now the data I have is complex
so its like
1.029399+1.53943j
I'm pretty sure IQ samples are complex so GQRX is fine
Yes exactly, I need to load a file into GQRX
pyrtlsdr said it normalized the values to +/- 1.0, maybe gqrx values don't? When you say the FFT is different, do you mean in the frequency domain, or just amplitude? Also, the data for one may be absolute frequency, and for the other, may be relative frequency to the passband you are monitoring.
My aim is to load a file containing the data from pyrtlsdr into GQRX for analysis. Do you know of any way to do this?
It looks like gqrx can take a "Complex Sampled (IQ) File" as a "Device". I see this when starting the AppImage without specifying anything on the command line (after I get an error window). I don't know what format this is in, and I haven't found a description in the documentation. THere is gqrx email list: https://groups.google.com/g/gqrx/. You could join and post a query
Hmm OK thanks.
say that you have numpy complex IQ files from pyrtlsdr and you want to get them into gqrx.
Ok sure
@young cove Another idea I'm thinking about, could I convert these voltages or data points into audio
and then analyse the audio in GQRX
you could do that, but we already know from the screenshot above that gqrx will take I+Q data, we just have to find out about the format. It's not so easy to convert to audio -- it takes math:
https://www.dsprelated.com/thread/7/how-to-convert-iq-signal-to-real (with MatLab, but the math is the same)
https://pysdr.org/index.html
did you ask on the email list?
mhmm
I only asked about 10 minutes ago though
thats true, but we have no idea how to make it take it and in what format
yeah, and you should say that the prtlsdr output is in numpy compelx float format
ok
we can find out -- it's not a secrect
It has had 3 views so far(my post) but no replies
it's not a very active list, I would expect it to take a bit
I don't think so, they are both I+Q, we just need to know the format, we can look at the code if necessary
can you upload a data file here to try?
what format would you like it in?
the numpy binary format, give me a short one
binary format? I have managed to get it to print out in float format
it prints in the form 0.4598459845 + -0.3589734897j
where j I assume is a complex number
we were talking about numpy load() and save() format above; that's the most compact and is easy to manipulate with numpy
numpy.load() returns a float for me
should I send you my code for the save to file and unpacking of the file?
pyrtl readsamples will return a numpy ndarray. Then use numpy.save() to write that out to a binary data file. it is two lines of code
yes, I have done this
and it works
can you give me one of those .save() files?
I have also created an unpacking of the file
sure I guess
short is fine, it's either going to work or not.
one of the .npy files yes?
yes
If that doesn't work should I send it in float sample
i am looking at the gqsrx source code, not yet. and I can convert it in numpy anyway
alright sure
my raspberry pi sometimes freezes up
I dont think I am feeding it enough voltage
thats not a big problem though
what is the amp rating of the AC adapter you are using
this is annoying
5V==1S
5V==1A
the normalized power supply is 5.1V==2.5A
I guess I am throttling it
ok @young cove I have the file in question
how does one send it to you
drag and drop?
time to connect pi to discord
!? very small numberof samples, how long did you sample for?
I asked it to do 10 samples although it might have frozen
it has either done 3000 or 10
oh well
well certainly not 3000
then it has done 10
get a chonkier AC adapter
like 3MHz
I asked it to read only 10 samples though
HAHA
it worked
@young cove did you get the file
yes, i downlaoded it. It looks like gqrx is using gnuradio under the covers, which is expecting a matlab-style complex I+Q file
Hmm I expected it would be using matlab
how should we go about making the .npy file a matlab style one
i found a lot of stuff about reading .npy IN matlab, but not external conversions
are you the only person doing this? Do you have people with numpy or matlab experience on your team?
do you have other software people on your team?
absolutely not
Me, myself and I
I coded my own fourier which works but GQRX is better
so the other people are hardware/balloon only?
essentially, and coding the function generator
we have an AD9801 or something module
this seems like it should work relatively easily
it's not looking like matlab format after all, it's looking like raw, hold on
ok.
https://numpy.org/doc/stable/reference/generated/numpy.ndarray.tofile.html can write raw binary
gqrx uses gnuradio. gnuradio has File Sink and File Source. File Sink writes out raw I+Q values https://wiki.gnuradio.org/index.php?title=File_Sink File source will read those values. So you can use .tofile() above to write a "File Sink" style complex I+Q file, and then read it in gqrx by giving the filename in the window I showed above. There is a place to give a filename and sampling rate, etc. in the "Device string" box:
I think that is a gnuradio device string. gqrx is basically a wrapper around gnuradio, as far as I can tell, so you need to start studying the gnuradio doc
I have to do some other work. I hope I have narrowed the path for you
you might also be able to find some code to convert the I+Q values to audio, but that's doing unnecessary computation, since gnuradio can use I+Q values anyway
how did you find all of this out?
just websearching, and knowing something about SDR's, having heard of gnuradio, etc.
oh fair enough, I'll try this tomorrow with a proper poower supply
its not particularly chunky but I've got a 5V, 2A one @young cove , in the real thing it will be powered by a Li-Po battery that is 6V(regulated to 5V) with something like 1.5A or a bit higher
but I will disable wifi and some other features
and it wont output to a screen
so less current
@young cove I'm getting the error: Parameter 'rate' is missing in arguments. Please select another device. I will show you the complex file I am asking it to go to
actually it just says file isnt opening
due to parameter 'rate' missing
All I did was rename the .npy file into a .raw file with the parameters Vladislav P gave me from the GQRX email list.
an .npy file is not a raw file. to convert from .npy to raw (using your samples.npy file as an example):
>>> import numpy as np
>>> np.load("samples.npy")
array([-0.23137255+0.19215686j, 0.41176471+0.46666667j,
-0.05098039+0.18431373j, -0.43529412-0.23921569j,
0.09803922-0.20784314j, -0.1372549 -0.39607843j,
0.25490196-0.09019608j, 0.54509804+0.3254902j ,
-0.52156863+0.09019608j, -0.43529412-0.27058824j])
>>> samples = np.load("samples.npy")
>>> samples.tofile("samples.raw")
Oh fine
now I'm working on reading it into gqrx, hold on a minute
The "Device String" has multiple things in. I changed file=, so it now says file=samples.raw,freq=100e6,rate=1e6,repeat=true,throttle=true. The frequency and rate are wrong -- you know what they should be. The file path is in my current directory, but you could do something like /home/yourusername/samples.raw or whatever to give a full path. An alternative is to use the Tools -> IQ Recorder window. See the menu bar:
I think you then need to set the right parameters:
does that make sense?
Or, according the email reply you got, I think you can rename the .raw file and it will parse the filename for the parameters it needs when you use the "I/Q recording and replay tool"
i am making an informed guess
re the files, notice the size difference between the raw file and the .npy file. The .npy file has metadata in it to describe what's in it so it's bigger:
$ ls -l samples.*
-rw-rw-r-- 1 halbert halbert 288 Mar 2 15:39 samples.npy
-rw-rw-r-- 1 halbert halbert 160 Mar 3 12:57 samples.raw
I see, Vladislav P said you have to play it in a certain fornat(filename) and then a .raw at the end
I'll play around with it once I reach home
The sample rate is 3MHz or 3e6
Tell me if you manage to get it working
file=samples.raw,freq=100e6,rate=1e6,repeat=true,throttle=true
what is freq, and I think you could set repeat=false
Rate = 3e6 actually, and freq = 95e6
Centre freq
i thought it was 27ish MHz
I noticed that when i tried playing the raw file, it scanned over and over, hence I think repeat=false is right
I think 95
Should I send you a new one with all the specs @tight sail
I've got some chonky 5.1V, 2.1A thing
This is centred at a frequency of 92.2MHz, an SDR gain of 4(dont know if that matters) and a sample rate of 2.4e6 or 2.4MHz
I tried renaming this to gqrx_230303_1506_92200000_2400000_fc.raw, and didn't see how that info was parsed. I think it is time to read the manual ๐
I also tried this earlier, it didn't work
I think you need %s
I don't really know what I am supposed to be seeing in the gqrx window when I play back samples. I did successfully supply all the parameters in file=samples.raw,freq=92.2e6,rate=2.4e6,repeat=false,throttle=true. I think you might try a much larger samples.raw, one that spans several seconds of samples, and maybe things will be clearer.
you might try using pyrtlsdr to record some AM or FMbroadacast or similar so when you play it in gqrx you will know what to expect
lotsa matlab in that one. You have probably seen these already
https://dsp.stackexchange.com/questions/50103/checking-for-vhf-pulse-with-sdr-and-python FFT in numpy and plotted
Wait, it actually worked, you didn't have to rename the file?
not if you give the parameters it's looking for in that parameter string, I believe.
the renaming is just another way to supply those parameters.
I have to do other work now, can you continue by yourself? Also see the last link above, which does an FFT without using gqrx
Yeah no problems, many thanks.
OH MY
@young cove IT WORKS
it just needs a lot of samples
thats fine
it needs like 15000+ samples
@young cove love you mate, thanks a lot, it works beautifully
repeat=false is godly
Look at that wow
oh, that is great (I think ๐ not sure what I should be seeing). The numpy-only FFT link I gave above might also be interesting, together with the plotting library. If you stay in numpy, then there are many analysis tools available in numpy and scipy. Lots of people use it so there are many examples and the documentation is good. But if gqrx is helping you, that's great too.
Yes, I have created my own fourier analysis program using pyfftw
but yeah I'll look into that too
How does this RF magic work? Might be something to do with the traces having an inductance that helps it radiate or something. But then why are there capacitors between ground and why are there even capacitors from the RF output to ground (it would seem like it would short the RF to ground). Why don't they use a simple monopole trace antenna or a chip antenna?
It looks like there's some magic in the copper plane shape too: https://abracon.com/datasheets/PRO-EB-592.pdf
Thanks for asking, I hadn't run across that technology before. Seems to be relatively new.
Maybe it's because it's very efficient
But why didn't rpi foundation just plop an ESP32-C3 in there and use a trace antenna as so many boards do?
Why did they go through the effort of using the cypress chip?
The ESP32 is probably too expensive and power hungry, they're trying to make the boards as affordable as possible. And that is a trace antenna, just a different type.
And they ctually used the cypress chip before on the Pi 3B so it didn't require much new development
Also wbga (or whatever it is) is smaller and prolly more affordable
So they could squeeze it in there unlike a qfn for an esp32 C3
They also get very good pricing on the modules they use in great quantity.
hi @pliant venture ! I am using a lora bonnet on a rpi zerow and reading the awesome guide you wrote on it: https://learn.adafruit.com/adafruit-radio-bonnets
Question: did you ever got to printa a case for it? I am looking around for an stl and have not found any. If you have not, I will try making one.... someday. ๐
hmm @primal warren @granite spear @young cove so basically, danh helped me out with importing a file into GQRX and the fourier in gqrx works perfectly. However when I run my own numpy fourier, there is so much random noise unlike gqrx, can any of you point me to a good example of an fft implementation that can filter out noise or produce nice peaks as mine currently fails to do so. Many Thanks.
Possibly it might be just the way you're plotting it? I'd expect GQRX might be defaulting to a decibel scale (effectively a log plot) whereas you might be plotting the linear values of the FFT, which might look different in terms of the size of the peaks and the noise. That's just a guess, though.
potentially hmmm
yes maybe
I was just going to ask a question about this exact bonnet lol
i have the 95C version
what code do you run on it?
@granite spear using this code just adjusting file lines
hi @glass jungle I use circuitpython with the code I posted here: https://github.com/flavio-fernandes/lora-ben/tree/main/rpi
np. The readme file should have the steps to install it: https://github.com/flavio-fernandes/lora-ben/blob/main/README.md
I'm using plain point to point lora. Works great!
np. I am thinking of doing a show-and-tell... if I find the time.
@primal warren@granite spear so my code is throwing errors when I give it complex data in the form: 0.0117647058823529+0.0117647058823529j
should I just discard the complex part or is there a way to run fourier on it as well
What's the actual error?
You might be able to separate the terms and compute the imaginary terms as real but make imaginary assumptions so to speak
The ifft() function should be able to take complex values, so it might be something else.
Might need to be number*j
0.0117647058823529+0.0117647058823529j its in this form
some crazy error
wait a second
yes this is the error @granite spear @half plover
C:\Users\aryan\AppData\Local\Programs\Python\Python310\lib\site-packages\pyfftw\builders_utils.py:196: UserWarning: Narrowing conversion from <U45 to float64 precision
warnings.warn("Narrowing conversion from %s to %s precision" % (a.dtype, dtype))
Traceback (most recent call last):
File "C:\Users\aryan\PycharmProjects\Fast Fourier Transform\main.py", line 36, in <module>
fhat = pyfftw.interfaces.numpy_fft.fft(f, n)
File "C:\Users\aryan\AppData\Local\Programs\Python\Python310\lib\site-packages\pyfftw\interfaces\numpy_fft.py", line 110, in fft
return _Xfftn(a, n, axis, overwrite_input, planner_effort,
File "C:\Users\aryan\AppData\Local\Programs\Python\Python310\lib\site-packages\pyfftw\interfaces_utils.py", line 136, in _Xfftn
FFTW_object = getattr(builders, calling_func)(*planner_args)
File "C:\Users\aryan\AppData\Local\Programs\Python\Python310\lib\site-packages\pyfftw\builders\builders.py", line 302, in fft
return _Xfftn(a, s, axes, overwrite_input, planner_effort,
File "C:\Users\aryan\AppData\Local\Programs\Python\Python310\lib\site-packages\pyfftw\builders_utils.py", line 203, in _Xfftn
a = numpy.asarray(a, dtype=dtype)
ValueError: complex() arg is a malformed string
the error is thrown after the fhat line @half plover @granite spear
oh I havent sent the code
import pyfftw
import multiprocessing
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['figure.figsize'] = [30, 21]
plt.rcParams.update({'font.size' : 10})
#Create a signal with two/multiple frequencies and some noise
dt = 4.16666667e-7 #Time div
with open('time.txt', 'r') as a:
t = [line.strip() for line in a]
with open('voltages.txt', 'r') as a:
f = [line.strip() for line in a]
#FFT computation
n = len(t)
print('works')
fhat = pyfftw.interfaces.numpy_fft.fft(f, n)
print('works')
PSD = fhat * np.conj(fhat) / n
print('works')
freq = (1/(dt*n)) * np.arange(n)
print('works')
L = np.arange(1, np.floor(n/2), dtype = 'int')
indices = PSD > 40
PSDclean = PSD * indices
fhat = indices * fhat
ffilt = pyfftw.interfaces.numpy_fft.ifft(fhat) #Filtered signal
#Plot
fig, axs = plt.subplots(3, 1)
plt.sca(axs[0])
plt.plot(freq[L], PSD[L], color = 'c', linewidth = 2, label = 'Noisy')
plt.plot(freq[L], PSDclean[L], color = 'k', linewidth = 1.5, label = 'Filtered')
plt.xlim(freq[L[0]], freq[L[-1]])
plt.xlabel('Frequency(Hz)', fontsize=12)
plt.ylabel('Power(PSD)', fontsize=12)
plt.legend()
plt.show()
This is my code
error thrown after fhat line as my print lines are checking the errors
Traceback (most recent call last):
File "C:\Users\aryan\PycharmProjects\Fast Fourier Transform\main.py", line 36, in <module>
fhat = pyfftw.interfaces.numpy_fft.fft(f, n)
File "C:\Users\aryan\AppData\Local\Programs\Python\Python310\lib\site-packages\pyfftw\interfaces\numpy_fft.py", line 110, in fft
return _Xfftn(a, n, axis, overwrite_input, planner_effort,
File "C:\Users\aryan\AppData\Local\Programs\Python\Python310\lib\site-packages\pyfftw\interfaces\_utils.py", line 136, in _Xfftn
FFTW_object = getattr(builders, calling_func)(*planner_args)
File "C:\Users\aryan\AppData\Local\Programs\Python\Python310\lib\site-packages\pyfftw\builders\builders.py", line 302, in fft
return _Xfftn(a, s, axes, overwrite_input, planner_effort,
File "C:\Users\aryan\AppData\Local\Programs\Python\Python310\lib\site-packages\pyfftw\builders\_utils.py", line 203, in _Xfftn
a = numpy.asarray(a, dtype=dtype)
ValueError: complex() arg is a malformed string```