Project - SAM TTS

SAM Text To Speech firmware is another example of CiccioCB wizardry.

Flash the SAM firmware to an ESP device, send some text to its serial port, then listen to the text being spoken from an attached speaker in a clear robotic voice, without requiring any additional expensive special hardware.

Note:
SAM firmware is independent of Annex, so it can speak text messages sent from any serial device or platform. 
For example: a different SAM project uses a 2nd ESP device running Annex in a Wemos dual adapter to create a Network Voice Announcer for eg: centrally announcing sensor alerts from various remote locations.
But that 2nd device might be running arduino, or anything else that is capable of sending text via serial.


Details
Uses any ESP device (even an old 512k ESP-01)
Wifi is disabled to reduce audio noise being generated from fluctuating supply current demands.
Text input = RX  (receives standard ascii text serial strings on gpio3)
Baud rate = auto-detect
Audio output = gpio2 (can drive a small speaker directly, see the comments below)
Busy signal = gpio0  (optional - can be used to light an LED when speaking, or for 'chatty'  handshaking with a 'sending' device).


If using gpio2 to directly drive a small low impedance (typically 8 ohms) speaker, the speaker should be connected between gpio2 and +3.3v (not 0v) to prevent gpio2 from effectively being shorted to ground via the 8 ohm speaker coil.

Alternatively the gpio2 audio output could be DC isolated through a capacitor, whose value should be 1uF or greater to avoid reducing the output volume too much - pay attention to polarity if using a polarised cap, depending on whether the speaker is connected to +3.3v or 0v.


Instead of a direct speaker, you could use an audio amplifier to provide greater volume, usually with the added convenience of a volume control. A search of an online supplier (eg: ebay or aliexpress) for "amplified speaker module" will result in several alternatives with integral volume control for less than 2 quid with free P&P.

You could keep things neat and tidy by including both the amplifier and SAM device inside a housing.
Or use a ready-built amplified speaker.
This amplified speaker from aliexpress was just over £6 free p&p - it has a rear USB powered amplifier with volume control and 3.5mm audio input jack, and plenty of room to fit a SAM module inside if wished (the front plastic speaker cover levers off),
A 5v to 3.3v psu module could easily be fitted inside to supply the SAM module with 3.3v from the 5v USB if needed.
And a 3.5mm jack socket could be fitted for the serial input and busy signal to eg: connect to the TX RX Hack project.

The no-frills circuit below may not look 'politically correct' without any resistors, but it works for me, even without the cap... and it doesn't get much simpler than that.
I discovered I could leave gpio0 grounded after flashing and SAM would still reboot and speak serial text ok, but probably better connecting gpio0 to the jack socket as a busy signal instead of the unused device TX output.
 
Lean mean speaking machine - this SAM TTS dead-bug speaker circuit could be even leaner by snipping off the unused aerial, and even meaner by omitting the capacitor.

How To

Flashing the SAM firmware is very simple...
Open Toolkit, select your appropriate Com port, click Serial Monitor, then click Connect in the Serial Monitor and note that the button turns green (so you will be able to see the SAM startup info).

Select Backup/Restore tab, then click the middle "Serial Restore Firmware to ESP" button after selecting the location of the SAM file - when finished, a confirmation window will pop up.
When the device is rebooted it should show a lot of startup info in the serial monitor.
It is now ready to speak serial input... so try typing something into the console then pressing 'Enter'.