I am working on a project where I want to decode DTMF tones from a cell phone, then send them to the arduino. I am using one of these http://www.dschmidt.com/dtmf.html#DTMF232-C to get asciii values from the DTMF tones. This works fine and I get ascii values when plugged into the PC. I should note here that the baud rate is 9600 and the serial is 8N1. (with no hardware handshaking - if this makes any difference to the arduino?)
Once I have ascii values they are sent to one of these Error, Electronic & Electronics Components Depot United States. which is supposed to convert to TTL voltages. I have the GND pin connected to GND. the VCC pin connected to 5V. As I want to make sure the values are actually getting into the arduino I want to connect the arduino to a pc and print out the data as it comes in, for this reason I have used the softserial function on the arduino through pins 2 and 3 (to leave pins 0,1 free for the usb cable to the pc - I hope this is correct?). I have connected the RX pin from the MAX232 to the TX softserial pin and the TX pin to the RX softserial pin.
I want the arduino to take the values from the input and print them to the pc. below is what im using;
#include <SoftwareSerial.h>
int incomingByte = 0;
SoftwareSerial mySerial(2,3); // RX,TX
void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
mySerial.begin(9600);
}
void loop() // run over and over
{
if (mySerial.available() > 0) {
// read the incoming byte:
incomingByte = mySerial.read();
// say what you got:
Serial.print("I received: ");
Serial.println(incomingByte, DEC);
}
}
When I set everything up, I get a flashing light on the DTMF decoder to let me know its sending a character, but apart from that I dont know how far my data is getting? its not showing up on the serial monitror but im not sure if its even making it through the max232. If anyone has adive on my setup or code or other debugging tips that would be great.
Sorry Im probabaly missing a whole heap of important information. I should say that im using an Arduino Uno board. Im also a complete newbie to arduino so let me know if I've explained something wrong?
Your solution looks completely reasonable to me and you have provided a clear and comprehensive description of the problem.
Since I can't see any obvious reason why it isn't working, I would approach this by dividing the problem up.
Can you use two SoftSerial instances in loopback to confirm that you can send and receive? (I understand you can only receive on one at a time but I believe they will work OK in loopback as long as only one is actively receiving at any given time.)
Can you connect your RS232/TTL converter/Arduino solution to a different serial source, for example the serial port on your PC that you used to test the DTMF decoder, and confirm that it is capable of sending and receiving?
I have connected the RX pin from the MAX232 to the TX softserial pin and the TX pin to the RX softserial pin.
Just to avoid confusion can you please state exactly which pins (by number) are connected from what to what? Just run by exactly what is connected to what on the MAX232 (including the DTMF device and the way you connected it to the Arduino).
I presume you have sent power and Gnd to the MAX232, and set up some capacitors, but can you confirm that?
Then please measure with a multimeter (or scope if you have one) what you are getting on the Rx pin of the Arduino (ie. pin D2). It should read high (ie. 5V) in the idle state.
Thanks PeterH, thanks for the suggestions, I will try some of these when I gets a chance and let you know how I get on.
Thanks also Nick, I have connected the pin labeled TX on the MAX232 converter to pin 2 on the arduino which I believe from my code above is set as the RX pin. with the RX pin from the converter plugged to pin 3 on the arduino. I should say that when it didn't work the first thing I tried was swapping the cables over, so I hope that didn't lead to me frying my pins?
I have got power and GND going to the MAX232 converter from the arduino (I am using the 5V power to the converter as I couldn't find a data sheet for the converter board so guessed, I read for a similar board that the power voltage was either 3.3 or 5 V so again hopefully I haven't fried anything). Not to sure about the capacitors??? I haven't got anything other than whats on the board, do I need something else? I thought that board was just for plug and play with the arduino?
When I power the max232 converter and measure across GND and RX pins on the board using multimeter I get 5V (well 4.96 actually).
Sorry hopefully that response wasn't too muddled. Thanks again for the replies, very much appreciated.