Difference between revisions of "MakaPython Audio"
(Created page with "== Introduction == The MakePython Audio board uses the uDA1334 digital to analog converter (DAC), which converts I2S (not be confused with I2C) audio to an analog signal to d...") |
(→Usage) |
||
Line 49: | Line 49: | ||
==Usage== | ==Usage== | ||
− | Warning: Don't operate when | + | Warning: Don't operate when powered on in case of short circuit.<br> |
+ | This guides help you how to use makepython Audio with Makepython ESP32 to fulfill text to speech(TTS). It also can play music from SD card or Flash too. | ||
+ | <br> | ||
− | + | Makepython ESP32(Wrover) used USB-to-UART(CP2104) to upload firmware, you can install the CP2102 driver from:<br> | |
− | + | https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers<br> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | < | ||
− | ===Project_1: | + | ===Indicator LED Status=== |
+ | |||
+ | {| cellspacing="0" cellpadding="5" border="1" | ||
+ | |- | ||
+ | | align="center" width="150" | '''Indicator LED''' | ||
+ | | align="center" width="200" | '''Status''' | ||
+ | |||
+ | |- style="font-size: 90%" | ||
+ | | align="center" | D3 | ||
+ | | align="center" | Light on when powered on, light off when powered off | ||
+ | |- style="font-size: 90%" | ||
+ | | align="center" | D1 | ||
+ | | align="center" | Light on when IO21 output low, light off when IO21 output High | ||
+ | |} | ||
+ | |||
+ | |||
+ | ===Project_1: Text to speech=== | ||
Attention: To get GPS location, please ensure you are outdoor, and plug the GPS Antenna. Indoor may get the incorrect location or no location information.<br> | Attention: To get GPS location, please ensure you are outdoor, and plug the GPS Antenna. Indoor may get the incorrect location or no location information.<br> | ||
<br> | <br> |
Revision as of 06:20, 2 July 2020
Contents
Introduction
The MakePython Audio board uses the uDA1334 digital to analog converter (DAC), which converts I2S (not be confused with I2C) audio to an analog signal to drive speakers. The I2S Audioboard converts the digital audio signals using the I2S standard to an analog signal.
Model: xxxxxxxx
Features
• NXP Low power Audio DAC: uDA1334 • Integrated digital filter plus DAC • Supports sample frequencies from 8 to 100 kHz • Automatic system clock versus sample rate detection • Low power consumption • I2S-bus and LSB-justified format compatible • Digital de-emphasis for 44.1 kHz sampling rate • Support Micro SD Card • Working Temperature: -40 – 85℃ • Size: 70*32.6mm
Interface Function
①toggle switch
②toggle switch
③Audio IC:uDA1443
④D3: PWR LED
⑤microSD card
⑥D1:LED controlled by IO21
⑦audio jack(3.5mm)
Required Materials
1. Makepython ESP32
2. MakePython Audio v2.0
3. microUSB Cable
4. Speaker
5. PC
6. SD card
You can get Makepython ESP32(Wrover) from: https://www.makerfabs.com/makepython-esp32.html
Note: Makepython ESP32 Wroom’s RAM is not enough for audio application, so you need Makepython ESP32(Wrover)
Usage
Warning: Don't operate when powered on in case of short circuit.
This guides help you how to use makepython Audio with Makepython ESP32 to fulfill text to speech(TTS). It also can play music from SD card or Flash too.
Makepython ESP32(Wrover) used USB-to-UART(CP2104) to upload firmware, you can install the CP2102 driver from:
https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers
Indicator LED Status
Indicator LED | Status |
D3 | Light on when powered on, light off when powered off |
D1 | Light on when IO21 output low, light off when IO21 output High |
Project_1: Text to speech
Attention: To get GPS location, please ensure you are outdoor, and plug the GPS Antenna. Indoor may get the incorrect location or no location information.
The example uses MicroPython programming, very simple and easy to understand.
This MakePython A9G can do nothing. It needs a microcontroller like ESP32 to drive it. The following two routines are implemented by A9G with MakePython ESP32, they can be directly combined to achieve various functions.
You can get MakePython ESP32 from here:
https://www.makerfabs.com/makepython-esp32.html
Step:
1. Plug in the GPS antenna
2. Plug to MakePython ESP32, connect the USB to the PC.
3. Sample code, or you can get it from here: A9G_GPS.py
from machine import UART,Pin,I2C import machine import ssd1306 import utime uart = UART(2, baudrate=115200, rx=21, tx=22,timeout=10) i2c = I2C(scl=Pin(5), sda=Pin(4), freq=100000) #Init i2c lcd=ssd1306.SSD1306_I2C(128,64,i2c) lcd.text('Hello, Makerfabs',0,0) lcd.text('waiting...',0,8) lcd.show() A9G_RESET_PIN = Pin(33, Pin.OUT) A9G_RESET_PIN.value(0) #set pin to low utime.sleep_ms(2000) A9G_PWR_KEY = Pin(27, Pin.OUT) A9G_PWR_KEY.value(0) utime.sleep_ms(2000) A9G_PWR_KEY.value(1) utime.sleep_ms(20000) #Display line wrap p=0 def text(string,c=0,r=0): global p if p>80: p=0 lcd.fill(0) colum=int(len(string)/15)+2 i=0 for a in range(0,colum): lcd.text(string[i:i+15],c,a*8) i=i+15 lcd.show() if True: lcd.fill(0) uart.write('AT+GPS=1\r\n')#1: turn on GPS 0:Turn off GPS utime.sleep_ms(1000) uart.write('AT+GPSRD=10\r\n') utime.sleep_ms(1000) uart.write('AT+LOCATION=2\r\n') utime.sleep_ms(1000) while True: if uart.any(): uart.write('AT+LOCATION=2\r\n') #Get GPS address bin_data = uart.readline() msg = len(bin_data) print(bin_data) mystr = str(bin_data[0:msg-2],'utf-8') lcd.fill(0) text(mystr,0,0) lcd.show() utime.sleep_ms(2000)
4. The screen displays NEMA message.
5. The screen displays GPS address.
- Location information may not be received indoors, and GPS NOT FIX NOW will be displayed on the screen if reception fails.
6. We can show our location where we are in https://www.gps-coordinates.net/.
Project_2: Display SMS message on OLED display
Please note that each text message may require some fees depending on your local GSM operator, make sure the SIM card is active, and leave enough money for this application.
This example also uses MakePython ESP32 for MicroPython programming.
Step:
1. Plug in the GSM antenna
2. Insert a mini SIM card(GPS does work without a SIM)
3. Plug to MakePython ESP32, connect the USB to the PC.
4. Sample code, or you can get it from here: A9G_GSM.py
from machine import UART,Pin,I2C import machine import ssd1306 import utime uart = UART(2, baudrate=115200, rx=21, tx=22,timeout=10) i2c = I2C(scl=Pin(5), sda=Pin(4), freq=100000) #Init i2c lcd=ssd1306.SSD1306_I2C(128,64,i2c) A9G_RESET_PIN = Pin(33, Pin.OUT) A9G_RESET_PIN.value(0) utime.sleep_ms(2000) A9G_PWR_KEY = Pin(27, Pin.OUT) A9G_PWR_KEY.value(0) utime.sleep_ms(2000) A9G_PWR_KEY.value(1) utime.sleep_ms(20000) p=0 def text(string,c=0,r=0): global p if p>80: p=0 lcd.fill(0) colum=int(len(string)/15)+2 i=0 for a in range(0,colum): lcd.text(string[i:i+15],c,a*8) i=i+15 lcd.show() if True: uart.write('AT+GPS=0\r\n')#1: turn on GPS 0:Turn off GPS utime.sleep_ms(1000) uart.write('AT+CCID\r\n') utime.sleep_ms(1000) uart.write('AT+CREG?\r\n') utime.sleep_ms(1000) uart.write('AT+CGATT=1\r\n') utime.sleep_ms(1000) uart.write('AT+CGACT=1,1\r\n') utime.sleep_ms(1000) uart.write('AT+CGDCONT=1,\"IP\",\"CMNET\"\r\n') utime.sleep_ms(1000) uart.write('AT+CSQ\r\n') utime.sleep_ms(1000) uart.write('AT+CPMS="SM","SM","SM"\r\n') utime.sleep_ms(1000) uart.write('AT+CMGF=1\r\n') utime.sleep_ms(1000) #uart.write('AT+CMGL="ALL"\r\n') #utime.sleep_ms(1000) while True: if uart.any(): lcd.fill(0) uart.write('AT+CMGR=1\r\n') utime.sleep_ms(1000) bin_data = uart.readline() print(bin_data) text(bin_data,0,0) lcd.show() utime.sleep_ms(2000)
4. The screen displays the phone number, time and information for sending SMS.
- Mobile phone to send SMS.
- Display the phone number and time of sending SMS
- Show received content
FAQ
You can list your questions here or contact with support@makerfabs.com for technology support.