portapack-mayhem / mayhem-firmware

Custom firmware for the HackRF+PortaPack H1/H2
GNU General Public License v3.0
3.19k stars 525 forks source link

Voice tx as transceiver with AM modulation [$85] #198

Closed AleyRobotics closed 1 year ago

AleyRobotics commented 3 years ago

Voice tx as real transeiver with FM works great! Is it possible voice tx as real transeiver with AM modulation?

--- There is a **[$85 open bounty](https://www.bountysource.com/issues/93134993-voice-tx-as-transceiver-with-am-modulation?utm_campaign=plugin&utm_content=tracker%2F182166508&utm_medium=issues&utm_source=github)** on this issue. Add to the bounty at [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F182166508&utm_medium=issues&utm_source=github).
JonaldJohnston commented 3 years ago

AM or SSB? they're kind of one in the same, but SSB is way harder to implement from what i understand

AleyRobotics commented 3 years ago

SSB

full AM modulation https://en.wikipedia.org/wiki/Single-sideband_modulation

strijar commented 3 years ago

I'm interested. I will try to implement this

texasyojimbo commented 3 years ago

This seems to be related to #84

strijar commented 3 years ago

I started implementing LSB/USB transmit

AleyRobotics commented 3 years ago

is there any progress or solution?

strijar commented 3 years ago

Yes, i wrote an implementation of the SSB modulator. It is working (https://github.com/strijar/portapack-mayhem/tree/ssb-tx)

It remains to add the choice of the mode in GUI. But I don't like how "Miс TX" is implemented now. I want to rewrite it to be in the style of a Amateur transceiver (;

jumbo77 commented 3 years ago

Very Useful for HAM~
Just Add HF Ampifire to work HF Transceiver

DomTheDorito commented 3 years ago

Yes, i wrote an implementation of the SSB modulator. It is working (https://github.com/strijar/portapack-mayhem/tree/ssb-tx)

It remains to add the choice of the mode in GUI. But I don't like how "Miс TX" is implemented now. I want to rewrite it to be in the style of a Amateur transceiver (;

Can we get a button to enable it at least while you rework the UI so we can test it out?

gerryk commented 3 years ago

Yes, i wrote an implementation of the SSB modulator. It is working (https://github.com/strijar/portapack-mayhem/tree/ssb-tx)

It remains to add the choice of the mode in GUI. But I don't like how "Miс TX" is implemented now. I want to rewrite it to be in the style of a Amateur transceiver (;

This looks good. At a quick glance it looks like it might be possible to replace the encoding in SSTV_TX with a selectable mode rather than the hardcoded FM that it currently in there. Currently the image processing and the encoding are folded in together but it could probably be done.

AleyRobotics commented 3 years ago

Tested at lab. Works great! Default Gain is too high. Will test it at field conditions.

strijar commented 3 years ago

Now I have little time to do this, but of course I will continue. There is an idea to make an alternative application "TRX" for testing modulators and UI. Leave the current "Mic TX" unchanged for now. (;

iz2fly commented 3 years ago

Congratulations, I've been waiting for this for a long time. Today I used HackRF_One with Portapack H2 in 1.2GHz, I connected an ham radio friend at 160Km in FM mode, excellent signal. SSB is greater than 6 dB, that would be excellent!!! HackRF_ONE_ANT

gerryk commented 3 years ago

I think now that a bounty has been offered, we should decide on some Acceptance Criteria for this solution, since the initial comment is a little light on specifics. So, let me start...

Acceptance Criteria

iz2fly commented 3 years ago

A little tip if possible, PTT should be as always, button pressed ON, button released OFF, but that's okay too.

aldude999 commented 3 years ago

Yes, i wrote an implementation of the SSB modulator. It is working (https://github.com/strijar/portapack-mayhem/tree/ssb-tx)

It remains to add the choice of the mode in GUI. But I don't like how "Miс TX" is implemented now. I want to rewrite it to be in the style of a Amateur transceiver (;

Good work on getting the Hilbert transform in there. I got it up and running but I found one issue. LSB worked but USB modulated both sides of the carrier. It looks like to flip between USB and LSB, you should set your hilbert.execute(sample, q, i) for USB, or hilbert.execute(sample, i, q) for LSB, and leave the re = q and im = i for both. I assume flipping re and im around is causing the phase to be at the wrong angle to null the other side out.

iz2fly commented 3 years ago

Great job strijar, gerryk, aldude999 and all the others. I would like to try how it works, how to do it? It's possible?

strijar commented 3 years ago

aldude999: I tested all three modes using the receive on the transceiver. Everything worked correctly. Perhaps you confused USB and DSB? The spectrum flipping is done on lines 61-64 in the dsp_modulate.cpp file

aldude999 commented 3 years ago

@iz2fly I have it implemented in mic_tx along with the proper RX for each mode, and a selectable FM RX bandwidth (something I realized I wanted last time I was using it for an actual purpose) I should be able to upload it tonight.

@strijar I pulled the code into the proc_mictx.cpp and viewed it on an FFT output from another SDR and did not see LSB suppression when USB was selected. I also did not see a DSB option in those lines. It's possible I did something wrong when pulling it over, but flipping the i and q for the hilbert transform seemed to solve the issue at least.

strijar commented 3 years ago

@aldude99: Hm... It is not enough to change only proc_mictx.cpp. There are a lot of changes.: https://github.com/eried/portapack-mayhem/compare/next...strijar:ssb-tx

See file firmware/baseband/dsp_modulate.cpp

    switch (mode) {
            case Mode::LSB:     re = q;     im = i;         break;
            case Mode::USB:     re = i;     im = q;         break;
            default:            re = 0;     im = 0;         break;
        }
aldude999 commented 3 years ago

https://github.com/aldude999/portapack-mayhem I have a compiled binary release to test AM/SSB/DSB modulation in the microphone app here.

This has a long way to go in regards to improvements since I kind of just wanted to get everything working so people could check it out.

iz2fly commented 3 years ago

https://github.com/aldude999/portapack-mayhem I have a compiled binary release to test AM/SSB/DSB modulation in the microphone app here.

This has a long way to go in regards to improvements since I kind of just wanted to get everything working so people could check it out.

Thank you very much for this achievement, I have waited many years to see this application! Now I can do some field tests. Thanks to all the developers, now only the details are missing. I don't know if there are ham radios in the team, otherwise I can suggest a more suitable graphic. Thanks so much again!!!

http://iz2fly.altervista.org/hackrf_one/

gerryk commented 3 years ago

Hey aldude I tried your build and it's working pretty well, even for a first drop! Mic gain seems a tiny bit high, but that could be my crappy mic. Tx on both sidebands seems good... need to figure out the exact carrier offset, as I was just using an AOR8200 to test receive.

Other issues are mainly UI related... widget order is a bit all over the place, but that seems to be the case whenever any UI is edited.

I have just tried USB & LSB, but results very promising.

/ Gerry

https://github.com/aldude999/portapack-mayhem I have a compiled binary release to test AM/SSB/DSB modulation in the microphone app here.

This has a long way to go in regards to improvements since I kind of just wanted to get everything working so people could check it out.

strijar commented 3 years ago

@iz2fly Yes, I don't like the current design of this app either. I was planning to completely redo it. Perhaps I will return to this question soon. It is interesting to listen to your wishes. 73 de R1CBU (:

sliceratwork commented 3 years ago

@iz2fly is that antenna bracket 3D printed or bought? Also, that's a log antenna right?

iz2fly commented 3 years ago

@sliceratwork Yes, 3D file antenna bracket now in my website.

The signal in SSB mode compared to FM is very low, but we expect improvements, perhaps not for the software but for the hardware.

aldude999 commented 3 years ago

SSB and AM TX power are directly linked to mic gain, so adjusting that will give you more or less power on the sidebands. I think more options than the .5, 1.0, 1.5, and 2.0 might be useful. Or some kind of simple compressor could be written to keep the audio at a reasonable level.

iz2fly commented 3 years ago

SSB and AM TX power are directly linked to mic gain, so adjusting that will give you more or less power on the sidebands. I think more options than the .5, 1.0, 1.5, and 2.0 might be useful. Or some kind of simple compressor could be written to keep the audio at a reasonable level.

Thanks for the reply, however, already now there are excellent results with USB transmission. 160 km with 1.2 GHz and 110 km with 2.3 and 5.7 GHz. I've been thinking about a new amateur radio interface, but maybe it's still early and I don't know if it's okay. Graphic_Github

iz2fly commented 3 years ago

I'm doing great tests in USB mode. I connected a small amplifier, SPF5189Z. The amplifier is connected with coaxial transfer switch, I would like to control the coaxial transfer switch with "Turn ON bias voltage". Is it possible to turn on bias voltage only in transmission mode and not during reception?

Radiomix2000 commented 3 years ago

@aldude999 Hi, I tried to compile your repo, and it seems the code doesn't have all necessary files. I have a lot errors related with dsp_sos and some IIR filters. Can you explain, what's wrong? Here is what I mean: console.txt

Also there is significant change in hackrf CPLD firmware (check Mossman repo). And now, to fix slow switching of TX/RX is necessary to comment out in firmware/application/radio.cpp the code

 //else {
                //      if( !hackrf::cpld::load_sram() ) {
                //              chSysHalt();
                        //}
                //}
aldude999 commented 3 years ago

@aldude999 Hi, I tried to compile your repo, and it seems the code doesn't have all necessary files. I have a lot errors related with dsp_sos and some IIR filters. Can you explain, what's wrong? Here is what I mean: console.txt

Also there is significant change in hackrf CPLD firmware (check Mossman repo). And now, to fix slow switching of TX/RX is necessary to comment out in firmware/application/radio.cpp the code

 //else {
                //      if( !hackrf::cpld::load_sram() ) {
                //              chSysHalt();
                        //}
                //}

Looks like I left out dsp_iir.cpp and dsp_iir.hpp in firmware/common from strijar's code. I'm going to try and rework my version to use his code more faithfully as it looks cleaner, and try and merge it with the new pushes before it gets too far behind.

Also I found my AM signal is not as strong as it could be, did some math and found out only modulating I or Q generates a signal at half strength. I figured modulating one would be the same as modulating both, but after testing it on a calculator I think I might be wrong as it resulted in a 50% modulation. Complex math is hard. :)

aldude999 commented 3 years ago

New version has been pushed to my repo with the new changes from this repo added. Tested the code and it looks good so far, new release is there as well. I tried to clean up the ui_mictx code to follow the order of the items better, along with fixing the RX audio listening button that I accidentally shrunk before. Also changed the message format to only require 4 extra boolean values, AM, DSB, USB, and LSB instead of passing some variables I used for testing previously.

Radiomix2000 commented 3 years ago

@aldude999 Hi, I tried to compile your repo, and it seems the code doesn't have all necessary files. I have a lot errors related with dsp_sos and some IIR filters. Can you explain, what's wrong? Here is what I mean: console.txt

Also there is significant change in hackrf CPLD firmware (check Mossman repo). And now, to fix slow switching of TX/RX is necessary to comment out in firmware/application/radio.cpp the code

 //else {
                //      if( !hackrf::cpld::load_sram() ) {
                //              chSysHalt();
                        //}
                //}

Looks like I left out dsp_iir.cpp and dsp_iir.hpp in firmware/common from strijar's code. I'm going to try and rework my version to use his code more faithfully as it looks cleaner, and try and merge it with the new pushes before it gets too far behind.

Also I found my AM signal is not as strong as it could be, did some math and found out only modulating I or Q generates a signal at half strength. I figured modulating one would be the same as modulating both, but after testing it on a calculator I think I might be wrong as it resulted in a 50% modulation. Complex math is hard. :)

I will check Gnuradio repo. There is AM modulator in gr-analog. So at least it can be helpful to implement AM for portapack. AM has 100% symmetrical spectrum, so is it right to just copy real stream to imaginary?

aldude999 commented 3 years ago

Yes, an identical real and imaginary value should result in AM modulation.

ultraohm commented 3 years ago

@aldude999 great job all AM SSB modes works great with HackRF and Portapack H2, However will it be possible to implement VOX (auto) and RX audio Listening in the Microphone window when we are in AM SSB mode? Thanks

iz2fly commented 3 years ago

Too complex to use the Microphone menu with separate RX and TX frequencies and fixed frequency steps, when you're ready the caller has already changed frequency.

gullradriel commented 3 years ago

In the search app I'm making you can search on 'hamradio' entries. When I'll have the time I hope to find a way with the mic app Devs so one can go from search app directly to mic app with the rx tx tone configured in the entry. Basically it'll allow to search on a ham radio list, with rx tx tone information, and on activity detection allow to jump to the mic app and set the parameters accordingly. I already have the search part working and only need to find a way to pass it to mic app.

gerryk commented 3 years ago

Since #84 is closed, this should also be closed, as they were effectively dups.

gerryk commented 3 years ago

Since #84 is closed, this should also be closed, as they were effectively dups.

Hi @gerryk This one still has a bounty on it, so not sure if this one can be closed.

Ok, cool. I haven't really looked into is so I'm not sure how the bounty mechanism actually works

iz2fly commented 3 years ago

Test Tx FM vs SSB

Gain-FM_vs_SSB

texasyojimbo commented 3 years ago

iz2fly -- how is the ssb signal being modulated?

is that a measure of just the suppressed carrier or the suppressed carrier plus some modulation? SSB signal power is proportional to modulation.

On Sun, Jun 27, 2021 at 11:35 AM iz2fly @.***> wrote:

Test Tx FM vs SSB

[image: Gain-FM_vs_SSB] https://user-images.githubusercontent.com/56764775/123551874-f6fe3d80-d773-11eb-8953-62c2df149065.PNG

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/eried/portapack-mayhem/issues/198#issuecomment-869190852, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQSTUHIF5G4D4C773TZ2KLTU5HODANCNFSM4RZRE4OQ .

iz2fly commented 3 years ago

The measurement is very simple and practical. It is a measure made as every ham radio does with his own radio. With voice (oooooola) or whistle, usually the emitted power is the same as in the FM mode.

See photo of the signal in FM mode 2300MHz FM_Mode

aldude999 commented 3 years ago

FM will always output full power regardless of how loud the input signal is. SSB is highly dependant on the microphone gain, so by turning that up, you are also turning the signal output up as well. If you are not giving it a signal at full volume, you won't get an output at max power.

teixeluis commented 3 years ago

@aldude999 I observed here:

https://github.com/eried/portapack-mayhem/issues/368

that in AM the carrier level is pretty low (I would expect that without modulation, FM and AM carriers should not differ much in power..)

In SSB even with modulation, the power output is comparatively low.

Cheers

iz2fly commented 3 years ago

FM will always output full power regardless of how loud the input signal is. SSB is highly dependant on the microphone gain, so by turning that up, you are also turning the signal output up as well. If you are not giving it a signal at full volume, you won't get an output at max power.

Thank you aldude999 for your comments. The vocal output was at full volume and with maximum gain and with various microphone capsules, maybe in SSB mode you need a different microphone than in FM mode? Or do you need an amplified microphone? the result is that in FM mode the signal reaches the listener, in SSB mode this is much much lower. Usually this does not happen with any other transceiver. Unfortunately I am not an expert and I cannot answer. Mine is just a factual finding. If this gain in SSB mode somehow can't be improved, that's okay, I'll put a signal amplifier on the output.

Brumi-2021 commented 2 years ago

Hi thanks to all of you for this great Mic TX App ! It has everything, combining TX/RX, with full mod. Types FM/AM/DSB/SSB , and including Mic-VOX control !!! Really amazing! Congratulations to all contributors ! I am also ham operator , and was looking for it ! Pls check my latest PR , just small fine tuning ,https://github.com/eried/portapack-mayhem/pull/457

iz2fly commented 1 year ago

After a long time I picked up the HackRF-One. Really amazing! Congratulations to all contributors! I have found many improvements in the Microphone APP.

TX-RX-Same_2

Brumi-2021 commented 1 year ago

Hi @iz2fly , thanks . I could see that you missed another important one , the empty space after MIC gain , will have Auto Level Mic Control (in AK4951 audio codec ) or Mic Boost control (in WM8731 audio codec) . Which one do you have ? Stay tuned , coming soon I will realise new PR with both integrated options. (Now pending latest checkings ) Cheers!

iz2fly commented 1 year ago

Hello @Brumi-2021 I really like these new updates. I have been absent for too long, even the battery needs to be changed. I am using the latest official firmware version 1.5.4. Are there any new updates already? Where can I find my audio codec? Cheers!

Brumi-2021 commented 1 year ago

Hi @iz2fly If you go to the "debug" -> peripherals menu , you will see which peripheral devices you can explore. And in the audio block icon , you will see the audio codec IC name , mounted on your Portapack board : AK4951 or WM8731.

270F5F7F-8372-4E00-A5CE-FDCBFCB3A903

by the way . You can install this hot advanced beta test fw , related to issue #683 (in future I hope to be merged in the official version ) 73, cheers