Skip to main content
deleted 65 characters in body
Source Link
kukrt
  • 529
  • 1
  • 5
  • 12

Let's say I am trying to embed a Pi WH in my motorcycle helmet. I need thin speakers just by the ear to hear sounds (so, I don't need them to be too loud).

  • by the way, piezo speakers won't do it in this project

Since Pi WH doesn't have a 3.5mm audio jack, I think my choices are

  1. use USB speakers
  2. use PWM + audio amplifier + speakers

I can certainly buy a set of USB speakers and just connect to it, but the size matters. so I am thinking #2 would only be my choice.

As far as I researched, I think this is the way to go.

  1. setup Option 1. Use Device Tree Overlay
    https://learn.adafruit.com/adding-basic-audio-ouput-to-raspberry-pi-zero/pi-zero-pwm-audio

  2. connect a LM386 audio amplifier to one of the PWM pins

  • RPi 5v pin -> VCC
  • RPi ground -> GND
  • RPi a PWM pin -> IN
  • RPi ground -> GND
  1. connect speakers like this to the audio amplifier

  2. remove noises by this config audio_pwm_mode=2

  3. play sounds by aplay command

Please let me know if any of the steps are wrong before I go ahead and buy all of the parts.


update:

I did the followings to just make sure a speaker without an amplifier would sound just enough.. but I hear nothing coming out of the speaker, not even a noise. It's complete silence. Anything I am missing or not doing right?

  1. add dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4 to /boot/config.txt
    dtparam=audio=on is not commented
  2. sudo raspi-config -> Advanced Options -> Audio -> Force 3.5mm ('headphone') jack
  3. reboot
  4. gpio readall shows
    ALT5 | GPIO. 1 | 1 | 18
    and
    | 13 | 23 | GPIO.23 | ALT0
  5. alsamixer and set the volume 100%
  6. hooked a speaker like this (PWM0 = stereo right channel?)
  7. aplay /usr/share/sounds/alsa/Rear_Center.wav or mpg321 some.mp3

enter image description here

Let's say I am trying to embed a Pi WH in my motorcycle helmet. I need thin speakers just by the ear to hear sounds (so, I don't need them to be too loud).

  • by the way, piezo speakers won't do it in this project

Since Pi WH doesn't have a 3.5mm audio jack, I think my choices are

  1. use USB speakers
  2. use PWM + audio amplifier + speakers

I can certainly buy a set of USB speakers and just connect to it, but the size matters. so I am thinking #2 would only be my choice.

As far as I researched, I think this is the way to go.

  1. setup Option 1. Use Device Tree Overlay
    https://learn.adafruit.com/adding-basic-audio-ouput-to-raspberry-pi-zero/pi-zero-pwm-audio

  2. connect a LM386 audio amplifier to one of the PWM pins

  • RPi 5v pin -> VCC
  • RPi ground -> GND
  • RPi a PWM pin -> IN
  • RPi ground -> GND
  1. connect speakers like this to the audio amplifier

  2. remove noises by this config audio_pwm_mode=2

  3. play sounds by aplay command

Please let me know if any of the steps are wrong before I go ahead and buy all of the parts.


update:

I did the followings to just make sure a speaker without an amplifier would sound just enough.. but I hear nothing coming out of the speaker, not even a noise. It's complete silence. Anything I am missing or not doing right?

  1. add dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4 to /boot/config.txt
  2. sudo raspi-config -> Advanced Options -> Audio -> Force 3.5mm ('headphone') jack
  3. reboot
  4. gpio readall shows
    ALT5 | GPIO. 1 | 1 | 18
    and
    | 13 | 23 | GPIO.23 | ALT0
  5. alsamixer and set the volume 100%
  6. hooked a speaker like this (PWM0 = stereo right channel?)
  7. aplay /usr/share/sounds/alsa/Rear_Center.wav or mpg321 some.mp3

enter image description here

Let's say I am trying to embed a Pi WH in my motorcycle helmet. I need thin speakers just by the ear to hear sounds (so, I don't need them to be too loud).

  • by the way, piezo speakers won't do it in this project

Since Pi WH doesn't have a 3.5mm audio jack, I think my choices are

  1. use USB speakers
  2. use PWM + audio amplifier + speakers

I can certainly buy a set of USB speakers and just connect to it, but the size matters. so I am thinking #2 would only be my choice.

As far as I researched, I think this is the way to go.

  1. setup Option 1. Use Device Tree Overlay
    https://learn.adafruit.com/adding-basic-audio-ouput-to-raspberry-pi-zero/pi-zero-pwm-audio

  2. connect a LM386 audio amplifier to one of the PWM pins

  • RPi 5v pin -> VCC
  • RPi ground -> GND
  • RPi a PWM pin -> IN
  • RPi ground -> GND
  1. connect speakers like this to the audio amplifier

  2. remove noises by this config audio_pwm_mode=2

  3. play sounds by aplay command

Please let me know if any of the steps are wrong before I go ahead and buy all of the parts.


update:

I did the followings to just make sure a speaker without an amplifier would sound just enough.. but I hear nothing coming out of the speaker, not even a noise. It's complete silence. Anything I am missing or not doing right?

  1. add dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4 to /boot/config.txt
    dtparam=audio=on is not commented
  2. sudo raspi-config -> Advanced Options -> Audio -> Force 3.5mm ('headphone') jack
  3. reboot
  4. gpio readall shows
    ALT5 | GPIO. 1 | 1 | 18
    and
    | 13 | 23 | GPIO.23 | ALT0
  5. alsamixer and set the volume 100%
  6. hooked a speaker like this (PWM0 = stereo right channel?)
  7. aplay /usr/share/sounds/alsa/Rear_Center.wav or mpg321 some.mp3

enter image description here

deleted 65 characters in body
Source Link
kukrt
  • 529
  • 1
  • 5
  • 12

Let's say I am trying to embed a Pi WH in my motorcycle helmet. I need thin speakers just by the ear to hear sounds (so, I don't need them to be too loud).

  • by the way, piezo speakers won't do it in this project

Since Pi WH doesn't have a 3.5mm audio jack, I think my choices are

  1. use USB speakers
  2. use PWM + audio amplifier + speakers

I can certainly buy a set of USB speakers and just connect to it, but the size matters. so I am thinking #2 would only be my choice.

As far as I researched, I think this is the way to go.

  1. setup Option 1. Use Device Tree Overlay
    https://learn.adafruit.com/adding-basic-audio-ouput-to-raspberry-pi-zero/pi-zero-pwm-audio

  2. connect a LM386 audio amplifier to one of the PWM pins

  • RPi 5v pin -> VCC
  • RPi ground -> GND
  • RPi a PWM pin -> IN
  • RPi ground -> GND
  1. connect speakers like this to the audio amplifier

  2. remove noises by this config audio_pwm_mode=2

  3. play sounds by aplay command

Please let me know if any of the steps are wrong before I go ahead and buy all of the parts.


update:

I did the followings to just make sure a speaker without an amplifier would sound just enough.. but I hear nothing coming out of the speaker, not even a noise. It's complete silence.
  Anything I am missing or not doing right?

  1. add dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4 to /boot/config.txt
  2. sudo raspi-config -> Advanced Options -> Audio -> Force 3.5mm ('headphone') jack
  3. reboot
  4. gpio readall shows
    ALT5 | GPIO. 1 | 1 | 18
    and
    | 13 | 23 | GPIO.23 | ALT0
  5. alsamixer and set the volume 100%
  6. hooked a speaker like this (PWM0 = stereo right channel?)
  7. aplay some/usr/share/sounds/alsa/Rear_Center.mp3
    ** by the way, any mp3 files I played with aplaywav showedor Unsigned 8 bit, Rate 8000 Hz,mpg321 Monosome.mp3 even though I know some of the mp3s were actually stereo

enter image description here

Let's say I am trying to embed a Pi WH in my motorcycle helmet. I need thin speakers just by the ear to hear sounds (so, I don't need them to be too loud).

  • by the way, piezo speakers won't do it in this project

Since Pi WH doesn't have a 3.5mm audio jack, I think my choices are

  1. use USB speakers
  2. use PWM + audio amplifier + speakers

I can certainly buy a set of USB speakers and just connect to it, but the size matters. so I am thinking #2 would only be my choice.

As far as I researched, I think this is the way to go.

  1. setup Option 1. Use Device Tree Overlay
    https://learn.adafruit.com/adding-basic-audio-ouput-to-raspberry-pi-zero/pi-zero-pwm-audio

  2. connect a LM386 audio amplifier to one of the PWM pins

  • RPi 5v pin -> VCC
  • RPi ground -> GND
  • RPi a PWM pin -> IN
  • RPi ground -> GND
  1. connect speakers like this to the audio amplifier

  2. remove noises by this config audio_pwm_mode=2

  3. play sounds by aplay command

Please let me know if any of the steps are wrong before I go ahead and buy all of the parts.


update:

I did the followings to just make sure a speaker without an amplifier would sound just enough.. but I hear nothing coming out of the speaker..
  Anything I am missing or not doing right?

  1. add dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4 to /boot/config.txt
  2. sudo raspi-config -> Advanced Options -> Audio -> Force 3.5mm ('headphone') jack
  3. reboot
  4. gpio readall shows
    ALT5 | GPIO. 1 | 1 | 18
    and
    | 13 | 23 | GPIO.23 | ALT0
  5. alsamixer and set the volume 100%
  6. hooked a speaker like this (PWM0 = stereo right channel?)
  7. aplay some.mp3
    ** by the way, any mp3 files I played with aplay showed Unsigned 8 bit, Rate 8000 Hz, Mono even though I know some of the mp3s were actually stereo

enter image description here

Let's say I am trying to embed a Pi WH in my motorcycle helmet. I need thin speakers just by the ear to hear sounds (so, I don't need them to be too loud).

  • by the way, piezo speakers won't do it in this project

Since Pi WH doesn't have a 3.5mm audio jack, I think my choices are

  1. use USB speakers
  2. use PWM + audio amplifier + speakers

I can certainly buy a set of USB speakers and just connect to it, but the size matters. so I am thinking #2 would only be my choice.

As far as I researched, I think this is the way to go.

  1. setup Option 1. Use Device Tree Overlay
    https://learn.adafruit.com/adding-basic-audio-ouput-to-raspberry-pi-zero/pi-zero-pwm-audio

  2. connect a LM386 audio amplifier to one of the PWM pins

  • RPi 5v pin -> VCC
  • RPi ground -> GND
  • RPi a PWM pin -> IN
  • RPi ground -> GND
  1. connect speakers like this to the audio amplifier

  2. remove noises by this config audio_pwm_mode=2

  3. play sounds by aplay command

Please let me know if any of the steps are wrong before I go ahead and buy all of the parts.


update:

I did the followings to just make sure a speaker without an amplifier would sound just enough.. but I hear nothing coming out of the speaker, not even a noise. It's complete silence. Anything I am missing or not doing right?

  1. add dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4 to /boot/config.txt
  2. sudo raspi-config -> Advanced Options -> Audio -> Force 3.5mm ('headphone') jack
  3. reboot
  4. gpio readall shows
    ALT5 | GPIO. 1 | 1 | 18
    and
    | 13 | 23 | GPIO.23 | ALT0
  5. alsamixer and set the volume 100%
  6. hooked a speaker like this (PWM0 = stereo right channel?)
  7. aplay /usr/share/sounds/alsa/Rear_Center.wav or mpg321 some.mp3

enter image description here

added 875 characters in body
Source Link
kukrt
  • 529
  • 1
  • 5
  • 12

Let's say I am trying to embed a Pi WH in my motorcycle helmet. I need thin speakers just by the ear to hear sounds (so, I don't need them to be too loud).

  • by the way, piezo speakers won't do it in this project

Since Pi WH doesn't have a 3.5mm audio jack, I think my choices are

  1. use USB speakers
  2. use PWM + audio amplifier + speakers

I can certainly buy a set of USB speakers and just connect to it, but the size matters. so I am thinking #2 would only be my choice.

As far as I researched, I think this is the way to go.

  1. setup Option 1. Use Device Tree Overlay
    https://learn.adafruit.com/adding-basic-audio-ouput-to-raspberry-pi-zero/pi-zero-pwm-audio

  2. connect a LM386 audio amplifier to one of the PWM pins

  • RPi 5v pin -> VCC
  • RPi ground -> GND
  • RPi a PWM pin -> IN
  • RPi ground -> GND
  1. connect speakers like this to the audio amplifier

  2. remove noises by this config audio_pwm_mode=2

  3. play sounds by aplay command

Please let me know if any of the steps are wrong before I go ahead and buy all of the parts.


update:

I did the followings to just make sure a speaker without an amplifier would sound just enough.. but I hear nothing coming out of the speaker..
Anything I am missing or not doing right?

  1. add dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4 to /boot/config.txt
  2. sudo raspi-config -> Advanced Options -> Audio -> Force 3.5mm ('headphone') jack
  3. reboot
  4. gpio readall shows
    ALT5 | GPIO. 1 | 1 | 18
    and
    | 13 | 23 | GPIO.23 | ALT0
  5. alsamixer and set the volume 100%
  6. hooked a speaker like this (PWM0 = stereo right channel?)
  7. aplay some.mp3
    ** by the way, any mp3 files I played with aplay showed Unsigned 8 bit, Rate 8000 Hz, Mono even though I know some of the mp3s were actually stereo

enter image description here

Let's say I am trying to embed a Pi WH in my motorcycle helmet. I need thin speakers just by the ear to hear sounds (so, I don't need them to be too loud).

  • by the way, piezo speakers won't do it in this project

Since Pi WH doesn't have a 3.5mm audio jack, I think my choices are

  1. use USB speakers
  2. use PWM + audio amplifier + speakers

I can certainly buy a set of USB speakers and just connect to it, but the size matters. so I am thinking #2 would only be my choice.

As far as I researched, I think this is the way to go.

  1. setup Option 1. Use Device Tree Overlay
    https://learn.adafruit.com/adding-basic-audio-ouput-to-raspberry-pi-zero/pi-zero-pwm-audio

  2. connect a LM386 audio amplifier to one of the PWM pins

  • RPi 5v pin -> VCC
  • RPi ground -> GND
  • RPi a PWM pin -> IN
  • RPi ground -> GND
  1. connect speakers like this to the audio amplifier

  2. remove noises by this config audio_pwm_mode=2

  3. play sounds by aplay command

Please let me know if any of the steps are wrong before I go ahead and buy all of the parts.

Let's say I am trying to embed a Pi WH in my motorcycle helmet. I need thin speakers just by the ear to hear sounds (so, I don't need them to be too loud).

  • by the way, piezo speakers won't do it in this project

Since Pi WH doesn't have a 3.5mm audio jack, I think my choices are

  1. use USB speakers
  2. use PWM + audio amplifier + speakers

I can certainly buy a set of USB speakers and just connect to it, but the size matters. so I am thinking #2 would only be my choice.

As far as I researched, I think this is the way to go.

  1. setup Option 1. Use Device Tree Overlay
    https://learn.adafruit.com/adding-basic-audio-ouput-to-raspberry-pi-zero/pi-zero-pwm-audio

  2. connect a LM386 audio amplifier to one of the PWM pins

  • RPi 5v pin -> VCC
  • RPi ground -> GND
  • RPi a PWM pin -> IN
  • RPi ground -> GND
  1. connect speakers like this to the audio amplifier

  2. remove noises by this config audio_pwm_mode=2

  3. play sounds by aplay command

Please let me know if any of the steps are wrong before I go ahead and buy all of the parts.


update:

I did the followings to just make sure a speaker without an amplifier would sound just enough.. but I hear nothing coming out of the speaker..
Anything I am missing or not doing right?

  1. add dtoverlay=pwm-2chan,pin=18,func=2,pin2=13,func2=4 to /boot/config.txt
  2. sudo raspi-config -> Advanced Options -> Audio -> Force 3.5mm ('headphone') jack
  3. reboot
  4. gpio readall shows
    ALT5 | GPIO. 1 | 1 | 18
    and
    | 13 | 23 | GPIO.23 | ALT0
  5. alsamixer and set the volume 100%
  6. hooked a speaker like this (PWM0 = stereo right channel?)
  7. aplay some.mp3
    ** by the way, any mp3 files I played with aplay showed Unsigned 8 bit, Rate 8000 Hz, Mono even though I know some of the mp3s were actually stereo

enter image description here

Source Link
kukrt
  • 529
  • 1
  • 5
  • 12
Loading