Update to SSTV demodulator

Forum for discussion of SSTV topics. Slow Scan television (SSTV) is a picture transmission method used mainly by amateur radio operators, to transmit and receive static pictures via radio in monochrome or colour.

Moderators: Dave Moll, Andrew Davie, Steve Anderson

Re: Update to SSTV demodulator

Postby Klaas Robers » Tue Oct 01, 2019 6:45 am

Looks well Steve.

But why do you need a post filter, if you are going to do the following processing in a digital way? Is it because the sampling speed at that point is different from the sampling speed of the FIR filter?

Any way this filter makes a better picture of the wave form on the oscilloscope. I am curious about the performance of the FIR-filter and the oscilloscope wave form is a better way to judge that.

How many taps can you make on the FIR-filter? Have you already an idea about that?
User avatar
Klaas Robers
"Gomez!", "Oh Morticia."
 
Posts: 1655
Joined: Wed Jan 24, 2007 8:42 pm
Location: Valkenswaard, the Netherlands

Re: Update to SSTV demodulator

Postby Steve Anderson » Tue Oct 01, 2019 2:38 pm

The post D-A filter (the analogue one) is mainly there to get rid of the harmonics of the sampling frequency as a result of the D-A process. Some early CD players didn't have a filter after the D-A and apparently sounded awful...I can't vouch for that though.

Here it may not make any difference at all, it's a case of try it and see...

As for the FIR filter, I've tried a number of schemes, some come out with only 15 taps, some with close to 40. The advantage is there are no hardware changes required to try a different arrangement. Alter the code and coefficients, load the PIC, see what happens...your soldering iron can remain cold all through the various iterations...

However, if I were to use this at the front of the SSTV-625 converter, you're correct, no need for the analogue output section except perhaps for monitoring the signal.

Steve A.
User avatar
Steve Anderson
"Fester! Don't do that to 'Thing'"
 
Posts: 5357
Joined: Fri Mar 30, 2007 10:54 pm
Location: Bangkok, Thailand

Re: Update to SSTV demodulator

Postby Klaas Robers » Thu Oct 03, 2019 12:15 am

If you choose the samplig frequency of the FIR-filter 8 times the cut off frequency, so cut off frequency = 1 kHz and sampling frequency = 8 kHz, then you may choose coeficients of a sync (sin(x) / x) function.

Then you will see that 1 out of 4 coefficients = zero, so you may skip that multiplication.

And the coefficients are symmetrical around the central tap, so you can first add the two samples and then do one multiplication. That will reduce the number of multiplications by two. This is a trick that I heard last weekend.
User avatar
Klaas Robers
"Gomez!", "Oh Morticia."
 
Posts: 1655
Joined: Wed Jan 24, 2007 8:42 pm
Location: Valkenswaard, the Netherlands

Re: Update to SSTV demodulator

Postby Steve Anderson » Thu Oct 03, 2019 1:04 pm

Klaas Robers wrote:If you choose the samplig frequency of the FIR-filter 8 times the cut off frequency, so cut off frequency = 1 kHz and sampling frequency = 8 kHz, then you may choose coeficients of a sync (sin(x) / x) function.

Then you will see that 1 out of 4 coefficients = zero, so you may skip that multiplication.


That is true, however the speed of calculation isn't really an issue, it's plenty fast enough for SSTV, other faster standards, well it may assist. As things are it takes 3.2us to do a 16-bit unsigned (the A-D output) by 16-bit signed (the coefficient) multiplication yielding a 32-bit result...which you truncate or round.

If the clock frequency is raised from 40MHz to 64MHz the same is achieved in 2.0us. But a change of device would be needed, say to a PIC18F26K22.

Klaas Robers wrote:And the coefficients are symmetrical around the central tap, so you can first add the two samples and then do one multiplication. That will reduce the number of multiplications by two. This is a trick that I heard last weekend.


Hmm, I can't see how that would work, if it does why has it not surfaced before? Any source/link you could point to?

Steve A.
User avatar
Steve Anderson
"Fester! Don't do that to 'Thing'"
 
Posts: 5357
Joined: Fri Mar 30, 2007 10:54 pm
Location: Bangkok, Thailand

Re: Update to SSTV demodulator

Postby Klaas Robers » Fri Oct 04, 2019 5:37 am

Steve, I would do it in this way:

1. Amplify and limit the input signal.
2. On each edge (up as well as down): measure the time to the previous edge.
3. Scale and limit the output to 7Fh for 1500 Hz black to 00h for 2300 Hz white. (7 bits is enough)
4. Go with his number through a look up table for a cycle-time to frequency conversion (6 bits is enough).

This ends the FM-detection process without any A/D conversion. Check the behaviour of the output using a ramping black to white signal. The line should be straight.

5. On a clock frequency of 8 kHz shift the latest frequency number into a shift register,
6. and do a multiplication of the frequency numbers in the shift register with coefficients
7. and add all results of the multiplications.
8. Round and scale to 6 bits (64 shades of grey)

This is the processing of the luminance video signal. Sync should be done separately.
User avatar
Klaas Robers
"Gomez!", "Oh Morticia."
 
Posts: 1655
Joined: Wed Jan 24, 2007 8:42 pm
Location: Valkenswaard, the Netherlands

Re: Update to SSTV demodulator

Postby Steve Anderson » Fri Oct 04, 2019 1:01 pm

Thanks Klaas. The first is a modification of the pulse-counting technique, I did make one of these a while back and it performed quite well. The second I need to think about once my brain decides to wake up...

One other factor we've not addressed so far is the modulator, this is just as important as the demodulator.

The one I'm using implements DDS (Direct Digital Synthesis) in a small 8-pin PIC micro. However there still is a low-pass filter on the input though it is a Bessel rather than a Butterworth, so less overshoot.

Most of the screen-shots were from files, (jpg's), not using this modulator - I'll have to look into this and see how I did it! (Yep, I've forgotten!).

More for sure...

Steve A.
User avatar
Steve Anderson
"Fester! Don't do that to 'Thing'"
 
Posts: 5357
Joined: Fri Mar 30, 2007 10:54 pm
Location: Bangkok, Thailand

Re: Update to SSTV demodulator

Postby Steve Anderson » Fri Oct 18, 2019 2:50 pm

As suggested by Klaas, here's my first[1] go at a zero-crossing SSTV demodulator, thereby eliminating all the Robot 70 analogue filtering, rectification and further filtering.

I used a 12-bit D-A simply because I can't find a source of serial 8-bit D-As, at least not here.

Yet to be built, code not written or tested...

Updates in due course...

The micro has a USB engine which may come in useful later on...

Steve A.

[1] Actually it's my second go, but the first was quite different!
Attachments
SSTV v3 Demodulator 1-Model.gif
SSTV v3 Demodulator 1-Model.gif (20.6 KiB) Viewed 13271 times
User avatar
Steve Anderson
"Fester! Don't do that to 'Thing'"
 
Posts: 5357
Joined: Fri Mar 30, 2007 10:54 pm
Location: Bangkok, Thailand

Re: Update to SSTV demodulator

Postby Harry Dalek » Fri Oct 18, 2019 8:12 pm

Looks good Steve I what put a like but we don't have that on the forum so have to reply ~ :wink:
The electromagnetic spectrum has no theoretical limit at either end. If all the mass/energy in the Universe is considered a 'limit', then that would be the only real theoretical limit to the maximum frequency attainable.
User avatar
Harry Dalek
"Fester! Don't do that to 'Thing'"
 
Posts: 5363
Joined: Fri Sep 26, 2008 4:58 pm
Location: Australia

Re: Update to SSTV demodulator

Postby Klaas Robers » Fri Oct 18, 2019 10:49 pm

Looks not bad Steve. However I would have placed an amplifier of about 1000x at the input. But may be you have that already on another circuit board?

My monitor gives already a usable result at an input signal of 0.3 mV. With a second diode limiter directly at the input it accepts a signal from 0.3 mV to 30 V rms. In this way I avoided a gain control at the input and I never have to think about the strenght of that signal.

No, I have no input filter, as the monitor is intended to work connected to my short wave SSB transmitter/receiver, of which the quartz mf-filter limits the audio frequency band to about 300 to 3000 Hz.

And I have been thinking of an exclusive OR just before the input of the processor. The second input of the EXOR is an connected to an output of the processor. Then at each negative edge of the input, which triggers the external interrupt, the routine inverts that output, so the next (positive) input edge becomes again a negative one and the routine runs again. That is exactly what you want/need.
User avatar
Klaas Robers
"Gomez!", "Oh Morticia."
 
Posts: 1655
Joined: Wed Jan 24, 2007 8:42 pm
Location: Valkenswaard, the Netherlands

Re: Update to SSTV demodulator

Postby Steve Anderson » Fri Oct 18, 2019 11:58 pm

Thanks chaps. The micro's comparators (though I'm only using one) have an on/off switchable hysteresis of around 65mV when enabled which should ensure rapid switching (around 200ns). But if the switching levels are uneven a simple gain stage can be stuck on the front, we'll see how it goes...

I had considered an input bandpass filter, but generally I'm not dealing with 'dirty' HF signals, and as you mentioned a good receiver should do that job anyway.

I've already made some minor changes, but they're not worth posting as yet. As ever design is an iterative process.

The comparators in this device can generate an interrupt on a positive-going output, a negative-going output, or both...I'll be using the 'both' option.

More to come...

Steve A.
User avatar
Steve Anderson
"Fester! Don't do that to 'Thing'"
 
Posts: 5357
Joined: Fri Mar 30, 2007 10:54 pm
Location: Bangkok, Thailand

Re: Update to SSTV demodulator

Postby Klaas Robers » Sat Oct 19, 2019 6:15 am

Steve Anderson wrote:......... The comparators in this device can generate an interrupt on a positive-going output, a negative-going output, or both...I'll be using the 'both' option.

That is a usefull feature which I never have seen. So I had to incorporate a hardware trick to come around. I see that micro-designers also find the better solutions.

I can see the use of the hysteresis, but I haven't used it and I think that I never missed it.....
User avatar
Klaas Robers
"Gomez!", "Oh Morticia."
 
Posts: 1655
Joined: Wed Jan 24, 2007 8:42 pm
Location: Valkenswaard, the Netherlands

Re: Update to SSTV demodulator

Postby Steve Anderson » Sat Oct 19, 2019 11:28 am

It all depends on the 'features' incorporated within the micro. In the PIC16Fxxx series (and PIC10/12) these features are not generally found, only in the PIC18xxx versions (or above, PIC24/PIC32 and so on, but these are 16 or 32 bit devices which I have yet to use). Also in the PIC18 series there's none of that pesky 'bank-switching' which requires additional instructions and takes time (cycles). In the PIC18 series the GPR (RAM) and SFR (generally peripheral registers) are all in a linear arrangement...much easier...plus an expanded instruction set.

One way around this for a 16F device is to use the comparator as usual, bring the output of the compatator onto a pin, then feed it back into an input that has IOC (Interrupt On Change). Two additional pins required, but that's life I'm afraid. IOC will generate an interrupt on a change in either direction of the input pin. Even so, I'm not sure if ALL 16F devices have IOC inputs, time to read the datasheets carefully...

For example in the popular 16F628, PORTB has four IOC inputs, RB<7:4>. Other devices I would think so too.

Steve A.

Actually the 16F628 isn't such a good example, it has what's needed, but there's probably better choices.

The 16F688 has six IOC input pins and both comparators outputs can be fed to a pin. It depends if the rest of the device has what you need. It's a 14-pin device, two pins are used for power, two used in the 'loopback' above and possibly two used for a crystal, leaving only eight pins free - is that enough? It depends on your I/O requirements.

Alternatively a 16F690 (20-pin DIL) has the 'ability to generate interrupts internally without the external 'loopback' on both edges of the comparator output. So you'll end up with 16 pins for other I/O.
User avatar
Steve Anderson
"Fester! Don't do that to 'Thing'"
 
Posts: 5357
Joined: Fri Mar 30, 2007 10:54 pm
Location: Bangkok, Thailand

Re: Update to SSTV demodulator

Postby Steve Anderson » Sun Oct 20, 2019 3:50 pm

I did a disservice to the 16F628A above, Comparator1 can internally generate an interrupt, though Comparator2 cannot.

This applies to the 16F627A and the 16F648A too. The only difference between the devices is the amount of program memory, RAM and EEPROM size. Add in a slight difference in cost - it is slight though.

All three are available in 18-pin DIP/DIL packages, so the above frees up two pins, and no need for an external pull-up resistor. (Compatator2's output pin, RA4, is open-drain, not push-pull, it's these little quirks that catch you out!).

Steve A.
User avatar
Steve Anderson
"Fester! Don't do that to 'Thing'"
 
Posts: 5357
Joined: Fri Mar 30, 2007 10:54 pm
Location: Bangkok, Thailand

Re: Update to SSTV demodulator

Postby Klaas Robers » Mon Oct 28, 2019 3:01 am

Understood Steve. But the 18f.... has a hardwire multiplication I learned from you. You will need that for a FIR-filter. Without that you have lack of time.

I am not so well introduced in the PIC controllers, you know much more of them. Go on !
User avatar
Klaas Robers
"Gomez!", "Oh Morticia."
 
Posts: 1655
Joined: Wed Jan 24, 2007 8:42 pm
Location: Valkenswaard, the Netherlands

Re: Update to SSTV demodulator

Postby Steve Anderson » Mon Oct 28, 2019 3:24 pm

Klaas Robers wrote:But the 18f.... has a hardware multiplication, you will need that for a FIR-filter. Without that you have lack of time.

At this point I'm not sure if a FIR filter may be required, but please allow me to change my mind!

Also I've got a division (reciprocal) bit of code to turn time into frequency. It's slower than a look-up table (around 50us for the diagram above), sure, but uses significantly less memory, and it's fast enough for this application. Which route will I go?...we'll see...

Steve A.
User avatar
Steve Anderson
"Fester! Don't do that to 'Thing'"
 
Posts: 5357
Joined: Fri Mar 30, 2007 10:54 pm
Location: Bangkok, Thailand

PreviousNext

Return to SSTV

Who is online

Users browsing this forum: No registered users and 1 guest