oe1wkl / Morserino-32

Morserino-32 multi-functional Morse code machine, based on ESP32
GNU General Public License v3.0
244 stars 95 forks source link

Make Sound from Speaker less harsh #67

Open GavinAndrews opened 1 year ago

GavinAndrews commented 1 year ago

Creating an issue for discussion...

The speaker sound to me is very harsh. I assume this is because it is fed from a PWM square wave and has abrupt starts and stops causing harmonics at the end.

Could this instead be fed from the ESP32's cosine wave generator and use the attenuation options 1/2, 1/4, 1/8 at the ends for optional decay at the start and ends? This would be 8-bit DDS might be enough?

Has this been tried? I'm tempted to give it a go.

oe1wkl commented 1 year ago

While this would be a nice undertaking, I think it is not possible with current M32 hardware (maybe an idea for a next generation Morserino?): You need one of the two DACs of the ESP32, which are on pins 25 and 26. Pin 25 is currently used as an output for keying an external transmitter, and Pin 26 is used internally within the Heltec module to control the LoRa module.

Willi

Am 04.01.2023 um 11:56 schrieb GavinAndrews @.***>:

Creating an issue for discussion...

The speaker sound to me is very harsh. I assume this is because it is fed from a PWM square wave and has abrupt starts and stops causing harmonics at the end.

Could this instead be fed from the ESP32's cosine wave generator and use the attenuation options 1/2, 1/4, 1/8 at the ends for optional decay at the start and ends? This would be 8-bit DDS might be enough?

Has this been tried? I'm tempted to give it a go.

— Reply to this email directly, view it on GitHub https://github.com/oe1wkl/Morserino-32/issues/67, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZR72FUT4T3YFAD5VNQY33WQVJNDANCNFSM6AAAAAATQU5PBU. You are receiving this because you are subscribed to this thread.

GavinAndrews commented 1 year ago

WiFi_Kit_series-master\esp32\libraries\LoraWan102\src\driver\board-config.h

define RADIO_DIO_0 26

Ah. That's a problem.

The only easy bodge would seem to be to swap GPIO23 and GPIO25 and perhaps remove R14 on the Heltec to avoid any interference from the LED. Nasty. Loses the LED flashing too.

image

GavinAndrews commented 1 year ago

OK... so here's my plan... not for the faint hearted...

I intend to lift R8 and R10, put the resistors vertical on one pad and then wire patch wires to the other pins; swapping Pin23 and Pin25... I cannot do that currently since obviously the sound is still currently being generated in Pin23.

In the interim I have moved the keyerPin to pin 13; freeing up pin 25.

I wrote a small snippet of code to drive the now free pin 25...

(Pin 25 is actually still connected to the Heltec LED and the M32 Opto; the Onboard LED glows dimly as expected).

NewFile8

Looks about right.

Now my analogue electronics is a bit weak... this signal obviously has a bias to it... What's the best way to connect to T2?

jwdossey4604 commented 1 year ago

10uF series capacitor. It doesn’t matter if it’s electrolytic or not, greater than 6V. 

John Wayne Dossey PE K5GD

On Wednesday, January 4, 2023, 6:12 PM, GavinAndrews @.***> wrote:

OK... so here's my plan... not for the faint hearted...

I intend to lift R8 and R10, put the resistors vertical on one pad and then wire patch wires to the other pins; swapping Pin23 and Pin25... I cannot do that currently since obviously the sound is still currently being generated in Pin23.

In the interim I have moved the keyerPin to pin 13; freeing up pin 25.

I wrote a small snippet of code to drive the now free pin 25...

Looks about right.

Now my analogue electronics is a bit weak... this signal obviously has a bias to it... What's the best way to connect to T2?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

oe1wkl commented 1 year ago

T2 is currently part of a discrete AND gate, which does pulse width modulation by applying a high frequency (for the purpose of volume control). Now the AND gate is certainly not linear, but you would need T2 linear so that it would not distort the sine wave - you probably have to apply some bias to the gate…

Willi Kraml @.***

Am 05.01.2023 um 07:12 schrieb GavinAndrews @.***>:

OK... so here's my plan... not for the faint hearted...

I intend to lift R8 and R10, put the resistors vertical on one pad and then wire patch wires to the other pins; swapping Pin23 and Pin25... I cannot do that currently since obviously the sound is still currently being generated in Pin23.

In the interim I have moved the keyerPin to pin 13; freeing up pin 25.

I wrote a small snippet of code to drive the now free pin 25...

https://user-images.githubusercontent.com/2669997/210673380-00046c57-5a19-4213-939f-2c02f8f6b8f6.png Looks about right.

Now my analogue electronics is a bit weak... this signal obviously has a bias to it... What's the best way to connect to T2?

— Reply to this email directly, view it on GitHub https://github.com/oe1wkl/Morserino-32/issues/67#issuecomment-1371568722, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACZR72CUNVMLJC22JJHOVJTWQYGWFANCNFSM6AAAAAATQU5PBU. You are receiving this because you commented.

GavinAndrews commented 1 year ago

If I ignore T1... probably short it...

image

I don't know if that is reasonable or not but it seems to transfer to the speaker without too much clipping

GavinAndrews commented 1 year ago

Incidentally the BC817 which I see in the BOM looks like a strange decision for an AND gate. A 2N7002 might be a better choice?

oe1wkl commented 1 year ago

Why? Von meinem Mobiltelefon gesendetAm 06.01.2023 um 21:14 schrieb GavinAndrews @.***>: Incidentally the BC817 which I see in the BOM looks like a strange decision for an AND gate. A 2N7002 might be a better choice?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>

GavinAndrews commented 1 year ago

I haven't given up but I can see I did make an error with respect to remapping the keyerPin to 13... this is already used by the battery voltage sense.

I'm now thinking of using I2S but would need 3 pins... 22 & 23... but still need one more.