Show Posts
Pages: 1 [2]
16  Using Arduino / Programming Questions / Re: trouble with rs232 comunication on: October 15, 2012, 08:35:32 am
i tried something that this tutorial said http://extremeelectronics.co.in/avr-tutorials/rs232-communication-the-level-conversion/

that says to plug out your mcu (arduino in case) and jump rx and tx to see if the comunication with the computer is working, then you open hyperterminal and the character that you send it should give you back. That has a good result so the problem is problaby in the code, does anyone already tried the code that i posted before ? ty all.
17  Using Arduino / Programming Questions / Re: trouble with rs232 comunication on: October 15, 2012, 08:27:46 am
the one that i found on google is that one http://www.extremeelectronics.co.in/avrtutorials/images/rs232_sche.GIF

the arduino tutorial say:
1 capacitor between 1 - 3
1 capacitor between 1 and ground
1 capacitor between 4 - 5
and 1 between 6 and ground

the on o googles tutorial say
1 capacitor between 1 - 3
1 capacitor between 2 and vcc
1 capacitor between 4 - 5
and 1 between 6 and ground
and 1 more between vcc and ground

i tried both ways with the same result smiley-cry

the arduinos tutorial also say to jump all the unused pins to vcc. the google one just say to keep it non conected.
18  Using Arduino / Programming Questions / Re: trouble with rs232 comunication on: October 15, 2012, 07:18:28 am
Well the schematic i cant post, because as you can see on the tutorial i have posted (http://www.arduino.cc/en/Tutorial/ArduinoSoftwareRS232) it does not show a schematic its just say "plug a capacitor between pin 1 and 3" and things like this, the code is that one:
Code:
#include <ctype.h>

#define bit9600Delay 84  
#define halfBit9600Delay 42
#define bit4800Delay 188
#define halfBit4800Delay 94

byte rx = 6;
byte tx = 7;
byte SWval;

void setup() {
  pinMode(rx,INPUT);
  pinMode(tx,OUTPUT);
  digitalWrite(tx,HIGH);
  digitalWrite(13,HIGH); //turn on debugging LED
  SWprint('h');  //debugging hello
  SWprint('i');
  SWprint(10); //carriage return
}

void SWprint(int data)
{
  byte mask;
  //startbit
  digitalWrite(tx,LOW);
  delayMicroseconds(bit9600Delay);
  for (mask = 0x01; mask>0; mask <<= 1) {
    if (data & mask){ // choose bit
     digitalWrite(tx,HIGH); // send 1
    }
    else{
     digitalWrite(tx,LOW); // send 0
    }
    delayMicroseconds(bit9600Delay);
  }
  //stop bit
  digitalWrite(tx, HIGH);
  delayMicroseconds(bit9600Delay);
}

int SWread()
{
  byte val = 0;
  while (digitalRead(rx));
  //wait for start bit
  if (digitalRead(rx) == LOW) {
    delayMicroseconds(halfBit9600Delay);
    for (int offset = 0; offset < 8; offset++) {
     delayMicroseconds(bit9600Delay);
     val |= digitalRead(rx) << offset;
    }
    //wait for stop bit + extra
    delayMicroseconds(bit9600Delay);
    delayMicroseconds(bit9600Delay);
    return val;
  }
}

void loop()
{
    SWval = SWread();
    SWprint(toupper(SWval));
}

But i do belive that the problem is in the "schematic" of this tutorial because i found some on the google and thats kinda diferent.

Moderator edit: Now with added Code Tagstm!
19  Using Arduino / Programming Questions / trouble with rs232 comunication (solved) on: October 15, 2012, 06:56:20 am
I followed this arduino tutorial http://www.arduino.cc/en/Tutorial/ArduinoSoftwareRS232 exactly how it shows but the "hi" that should apear just apears a strange "number" (its not a number and its not a letter its something stange like ₢° and things like these) and when i type any letter on the keyboard it should send it for me back but it send another strange "number".

Anyone have any idea what it could be ?
Thanks all.
20  Using Arduino / Programming Questions / Re: Rs232 comunication with an inclinometer 0729-1752 on: October 08, 2012, 09:03:47 am
BTW
Code:
int ax = 88;
int ay = 89;
is much easier to read as
Code:
char xCommand = 'X';
char yCommand = 'Y';
(or whatever "Command" translates to in Portugese)

yeah this i already tried ^^
21  Using Arduino / Programming Questions / Re: Rs232 comunication with an inclinometer 0729-1752 on: October 08, 2012, 08:41:10 am
Ok i will try that, working or not i will post it here then,
thanks a lot.
22  Using Arduino / Programming Questions / Re: Rs232 comunication with an inclinometer 0729-1752 on: October 08, 2012, 08:32:00 am
Sure,

http://www.frederickscom.com/pdf/6200-006-rs232.pdf
thats the mini signal conditioner board, the sensor is sold already on it by the manufacter as the 0729-1752 that you can see here http://www.frederickscom.com/pdf/0729-17XX%202009-03-03.pdf, but the instructions is in the first link.
23  Using Arduino / Programming Questions / Re: Rs232 comunication with an inclinometer 0729-1752 on: October 08, 2012, 08:15:09 am
What are you using for RS232 level conversion?

Code:
float x = portOne.read();
The "read" method returns an "int" representing a single character, not a floating point number.
You need to buffer the characters representing the float, and use an explicit method like "atof" to convert from ASCII.

Yeah, thats problaby the problem, so do i need to recive int by int and create a buffer for that ? the signal from the sensor is 16bits for angles and 10bits for temperature.
24  International / Portugues / Re: AJUDA comunicação rs232 arduino com inclinometro 0729-1752 on: October 08, 2012, 08:11:45 am
É infeslimente usar 0x88 não deu resultado.
Alguem tem outra idéia ?
Eu acredito que hardwareserial resolveria o problema porem não sei muito bem como usa-lo os exemplos do forum e do google são muito diretos, alguem teria algum material ou tutorial sobre o assunto ? ou só algumas dicas msm talvez já ajude.
25  Using Arduino / Programming Questions / Re: Rs232 comunication with an inclinometer 0729-1752 on: October 08, 2012, 08:08:33 am
I dont really know if a level conversion is needed cause i guess the sensor already have a level converter,
And i did comunicate the sensor with the pc using realterm (but unfortunately i cannot use a pc for the aplication) without using a level converter, thats why i think its a software problem.
26  Using Arduino / Programming Questions / Rs232 comunication with an inclinometer 0729-1752 on: October 08, 2012, 07:52:58 am
Good morning all,

I'm trying to comunicate the arduino with an inclinometer (rs 232 comunication, sensor have 4 pins vcc, gnd, rx, tx so a found that the comunication should be easy) then i need to send to the sensor what i want ('X' or 88 in ascii, then 'Y' or 89 in ascii) and recive the angles.
I tried with softwareserial with no results.
I think hardwareserial should work but i dont realy know how to use it. I have searched for it but i just found ready examples that i didnt understand nothing. Have anyone any tutorial, or something explained in detail ?
Do you have any other ideia how can i comunicate to the sensor ?

The sensor is the inclinometer 0729-1752, and one of the codes using Softwareserial that i tried to use was that:

#include <SoftwareSerial.h>
SoftwareSerial portOne(2, 3);
int ax = 88;
int ay = 89;


void setup()
{

  Serial.begin(9600);
    portOne.begin(9600);
}



 
void loop()
{


  portOne.write(ax);
  float x = portOne.read();
  delay(100);
  portOne.write(ay);
  float y = portOne.read();
  delay(100);

  Serial.print(x);
  Serial.println(y); 



Thanks for all, any help with be very welcome.
27  International / Portugues / Re: AJUDA comunicação rs232 arduino com inclinometro 0729-1752 on: October 05, 2012, 07:30:59 am
usei os pinos 2 para RX e 3 para TX.
então não sei mais farei o teste aqui usando 0x88.
28  International / Portugues / AJUDA comunicação rs232 arduino com inclinometro 0729-1752 on: October 04, 2012, 09:34:12 am
Bom dia,

Estou desenvolvendo um dispositivo que precisa de um sensor extremamente preciso de inclinação (já tentei com acelerometros, é bom, mais da uma variação de 0,1 grau que é inaceitavel para este dispositivo).
No caso estou tentando usar arduino para fazer esta comunicação.
O sensor tem os pinos  RX e TX e são supostos de me enviar as informações dos angulos X e Y. (O sensor tem 4 pinos vcc, gnd, Tx e Rx).
Primeiramente tentei usar um softwareserial para comunicar.
No manual diz que ele envia com o pedido, no caso tentei enviar mySerial.write(88) (88 = 'X' em ascii , que é o comando dito no manual do sensor) tentei de outras variadas formas porém aparentemente o arduino não está lendo os angulos enviados.
A resposta do sensor em ascii deveria ser o algulo X em 16 bits. O comando mySerial.read() não está realizando esta leitura.

Devo continuar usando softwareserial ou devo tentar usar hardwareserial ? alguem tem qualquer post, idéia, dica ou correção que possa ajudar ?

Desde já agradeço.
Hugo Sanches
Pages: 1 [2]