I have a problem to get the speaker work. In the PocketStar.cpp I can read that the speaker should be on PIN14 (PA02), but I cannot get any noise out of it. I tried to use it as an analog port, a digital port and send to it pwms in several frequensis, but nothing. Not a single crackling.
Maybe my speaker's broken, I don't know. Do you have any test program to check the speaker?
We had forgotten to mention that on Kickstater but we had to leave out the speaker for safety reasons. Due to a error in the PCB design, the amplifier became very hot when sound was played. But the amplifier itself is still on the board and in the code are still parts for sound.
Unfortunately we couldn't change the design because we were already too late. If we would build another prototype, the shipment would be delayed for at least another 2-3 months. :/
We are designing a second improved version of the PocketStar, but it runs with the same software. We may then exchange a few PocketStars for those who want the improved PocketStar.
We are very sorry for that!
Okay, I noticed the hot amplifier 😉
That can happen, so I won't include the sound, good to know.
Please keep in mind that if it is repaired, the software must know if it is a version with a working speaker or a version without in order not to overheat the amplifier. Or you can use a different PIN, of course 😉
When we tested the speaker, the sound was played but there was a noise louder than the sound itself.
It is very difficult to amplify the sound of the PocketStar, because the output current is just 7mA. If you amplify that, the background noise will also increase. We tried to filter it with a capacitor, but it didn't make a big difference.
It would have been better if we had implemented the example of Arduino.
In the next version we will definitely install a speaker and some other features. Then we will exchange some PocketStars as I have already said. 🙂
hmm, 7mA is rather much current in my opinion... At 3,3V, this is a impedance of about 500 Ohm - much less than the normal aux signals. Even a simple transistor should be able to convert this to a impedance of about 8-32 Ohm... Did you try a digital or analog signal? The D/A converter has a much higher impedance - the datasheet only guarantees "< 5 kOhm). At least for me, the possibility to drive the speaker with a simple digital square signal would be enough. Just to be sure: DRVSTR was 1 ?
Is there a circuit plan for the pocketstar?
We used a single transistor amplifier to save space. It would have been better to take the example of Arduino and use a 4-layer PCB. We will do that in the next version.
We used several different resistors & capacitors but nothing changed it.
The sound was very quiet and the noise was very loud. With a darlington transistor it could amplify the sound again but I really do not know what causes the noise.
Here is the schematic of the amplifier circuit:
Hmm, this schematics remembers me about Fig-3 at https://www.hackster.io/jwzumwalt/single-transistor-audio-amp-32033a - but your R16 is 10 times higher, and I don't understand why. I think that this explains your problems as well...
I think I had rather used something like http://homediyelectronics.com/projects/simpletransistoramplifier/ - or even like Fig. 1 at https://www.hackster.io/jwzumwalt/single-transistor-audio-amp-32033a . We are lucky here needing only a current amplifier - and no voltage amplifier 😉 You certainly don't need a Darlington transistor here. I would even prefer a transistor which hasn't much gain. A gain of 100 is more than enough. I mean, even if you get only 1mA out of the microcontroller this means 100 mA at the speaker. Even at 8 ohm this means 800 mV and thus 80 mW - which is already a lot... But I would use a 32 ohm one - which means 3,2V and 300 mW! This is way too _much_ for this device... But additionally, this would fit the voltage situation quite nice.
Btw, which speaker had you tried? I think I'll need to play a bit 😀
Additional note: You have already a very current-intense device on the pocketstar - the vibrator! I think I'll try to drive this with a square signal and hear what happens 😀 I wouldn't use this for playing real audio files, but it should be more than sufficient for the typical sound 30 years ago...
You might lough, but some motors are rather good speakers - https://www.researchgate.net/post/Can_a_DC_motor_behave_like_a_speaker