Like the title says, I've been trying to connect my Arduino Uno to an Aztech Turbo 2 voice modem (not sure about the chipset it uses - the included AT Command reference manual is for "for RCV56ACx, RCV336ACx, RCV288ACx and RCV144ACx Modems") to use it as a voicemail. All works well until I issue the "AT#VRX" command to receive voice data on the serial port: it just sends "CONNECT" on the Serial line and doesn't send any data and if i send a CRLF it answers "VCON" like it should do when it stops sending the sampled audio. I tried sending the same commands using the physical RS232 serial port on my PC's motherboard and it works so I cannot understand why it doesn't work with the Arduino.
I tried connecting the modem via a MAX232 based RS232-TTL serial converter module as well as hooking two wires on the modem's internal RS232-TTL converter on the TTL side to directly send data to its processor's serial lines and in both cases it just doesn't work.
All other commands seem to be fine.
I checked if the baudrate on the Arduino's SoftwareSerial port was enough and it is.
I also tried sending commands manually using the "TwoPortSerial" sketch and I got the same result.
You won't be able to record much audio in the 2k SRAM on an Uno.
Post a link to the datasheet for the modem.
...R
Thanks for the answer.
I didn't want to record audio in the SRAM. I plan to eventually record it on a SD card if the speed of the SPI bus is enough, but my problem now is that the modem doesn't send the audio at all.
I attached the only document I have about the modem's chipset... It includes all the information about the commands that the modem accepts.
ATCOMSET.DOC (562 KB)
This sounds to me like a project that would be much better suited to a Raspberry Pi.
When you switch to Voice Receive mode what stuff do you expect to appear from the modem? My guess is that it will be an audio signal that could be heard if connected to a loudspeaker.
An Arduino's USART is not designed to receive anything like that. It is only designed to receive digital signals in a specific format.
Perhaps you could use a jumper to connect the output from the modem to one of the Arduino analog input pins and use the ADC to sample the signal. But the ADC is not very fast so the quality will probably be very low. And IIRC telehone audio used to be filtered to reduce the required bandwidth so you may be getting a poor quality sample of a poor quality signal.
Writing to an SD Card is also relatively slow.
...R
When you switch to voice mode and issue the voice receive command, the modem's internal ADC samples the audio data on the selected input (phone line or microphone input jack) and sends on the serial line the raw digital audio data encoded in G.721, GSM or IMA ADPCM format. It is designed to work with a serial port. It doesn't involve any analogic signal between the modem and the device connected to the serial line. The modem handles the analogic part.
I don't mean to be rude but I think you haven't read a single word of the file I sent you because if you go to the voice mode part it is quite clear that the audio is sampled and sent encoded in a digital format to the computer connected to the serial line.
I'm not sure about the SD card part... The speed needed is not much (about 38400 baud with an 8kHz sample rate on the modem) but I don't remember what the SD writing speeds are.
PhaseSeeker:
I don't mean to be rude but I think you haven't read a single word of the file I sent you because if you go to the voice mode part it is quite clear that the audio is sampled and sent encoded in a digital format to the computer connected to the serial line.
I did read a few words. But I have no interest in learning all about a piece of hardware I will never use so I certainly did not read, and don't intend to read, the whole document. On the other hand if you want to refer me to one or two pages ...
What exactly is G.721, GSM or IMA ADPCM format? Do you mean that the modem sends a series of numbers at one of the standard baud rates (which rate?) and the numbers represent the digital values of the sampled sound?
Post the program you are using for testing.
...R
(about 38400 baud with an 8kHz sample rate on the modem)
38400 Baud over a serial line corresponds to 3840 8 bit characters per second.
Can you explain how an 8 kHz sample rate works with that data transmission rate?
It sends the values sampled by the ADC encoded in one of the three formats, so, as you said, it basically sends a series of numbers on the serial line. The baud rate depends on the sampling rate chosen and the number of bits per sample; With four bits and 7.2 kHz sampling rate a baudrate of 38400 baud/s is enough and so it's what I am using.
The program I am using for test is just the TwoPortsSerial sketch. I manually send commands to the modem through the Serial monitor.
The sequence of commands I am using (and that works when using my PC's serial port) is:
AT#CLS=8 (set voice mode)
AT#VSM=129, 7200 (G.721 encoding, 7.2 kHz sample rate)
AT#BDR=16 (turn off autobaud and set baud rate to 38400 bps)
AT#VRX (voice receive)
@jregminton The sample rate is 7.2 kHz, not as I said 8 kHz (I wrote 8 kHz by mistake because i got confused by the fact that the modem reports 8000 even if the selected baudrate is 7.2 kHz)
That said, one sample can use less than eight bits (it can be selected by the user out of two or three values, the default is four bits per sample) so that explains how it is possible. There is a table in the voice section of the document I sent that explains the relationship between sample rate and minimum baud rate.
P.S: Even setting the baudrate higher than the reported minimum of 38400 baud per second does not solve the problem.
4 bit audio samples at 7.2 kHz sample rate must sound terrible!
PhaseSeeker:
P.S: Even setting the baudrate higher than the reported minimum of 38400 baud per second does not solve the problem.
You have still not posted the program you are using for testing.
...R
I said in the post before that I'm just using the TwoPortSerial sketch from SoftwareSerial to send commands
PhaseSeeker:
I said in the post before that I'm just using the TwoPortSerial sketch from SoftwareSerial to send commands
It is much easier to help when you post the code that YOU have uploaded to your Arduino so we don't have to go looking for it and then wonder if I have actually found the same code that you have, or something similar but different.
...R
I really don't see why you need the same code that is present in every Arduino IDE, but here you are:
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(38400);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
mySerial.begin(38400);
}
void loop() { // run over and over
if (mySerial.available()) {
Serial.write(mySerial.read());
}
if(Serial.available()) {
mySerial.write(Serial.read());
}
}
@jregminton Yes, the sound isn't that good, but it is good enough for the recorded voice to be intelligible so for this use it should be fine.
PhaseSeeker:
I really don't see why you need the same code that is present in every Arduino IDE, but here you are:
I don't see any code in that program to change the modem to the voice-receive mode.
38400 baud can be marginal for SoftwareSerial. This is probably a task that would be more suited to an Arduino with at least two HardwareSerial ports - such as Mega, Leonardo or Micro.
...R