RegisterSearchFAQMemberlistUsergroupsLog in
Reply to topic Page 1 of 1
Sending data to arduino via aux serial port
Author Message
Reply with quote
Post Sending data to arduino via aux serial port 
I'm trying to use the Aux serial port on my Racecapture Pro Mk2 to send data to an arduino uno. I know thw racecapture is sending the data but it's showing up as gibberish on the arduino.

Baud rate is set at 9600 across the board. I have the aux TX pin going into the TX pin on the arduino (pin 1) and the RX into RX (pin 0)

Is there anything I'm missing on this? I tried switching the TX and RX but with that, nothing showed up.

Racecapture Pro Mk2 script
Code:
tickRate = 25

ser_baud = 9600
ser_port = 4
ser_bits = 8
ser_par = 0
ser_sbit = 1

ser_start_char = '<'
ser_end_char = '>'

function sendDataToDis()   
   local oilTemp = 123
   local coolTemp = 789
   
   local mes = ser_start_char .. oilTemp .. "|" .. coolTemp .. ser_end_char
   
   writeSer(ser_port, mes)   
end

function onTick()
 sendDataToDis()
end

setTickRate(tickRate)
initSer(ser_port, ser_baud, ser_bits, ser_par, ser_sbit)


Arduino Code
Code:
void setup() {
    Serial.begin(19200);
    Serial.println("<Arduino is ready>");
}

void loop() {
    recvWithStartEndMarkers();
}

void recvWithStartEndMarkers() {
    char startMarker = '<';
    char endMarker = '>';
    char rc;
 
    while (Serial.available() > 0) {
        rc = Serial.read();
        Serial.println(rc);
    }
}





Capture.PNG
 Description:
Arduino serial output
 Filesize:  8.19 KB
 Viewed:  2479 Time(s)

Capture.PNG


View user's profile Send private message
Reply with quote
Post  
Looks like a baud rate issue. Have you tried different baud rates on the Arduino side?

Also, you can get a USB to serial adapter for your computer as an alternate way to test, and use a terminal program to test your data output.


_________________
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter
View user's profile Send private message Send e-mail
Reply with quote
Post  
This is waking up an old thread but hopefully this may help others having trouble connecting devices with a serial interface (e.g. Arduino, maybe some gauges, etc.) to the RaceCapturePro Aux serial interface.

The problem is that the serial ports on the RCP and Arduino use different physical level (electrical) interfaces. The asynchronous serial protocol (baud rates, stop bits, etc.) riding on top of the physical layer is the same.

The RCP aux port uses an RS232 electrical interface with signals of -12V (logical 1) and +12V (logical 0).

Arduino COM ports use a TTL electrical interface with signal levels of +3.3 volt (or 5 volt) for a logical 1, and 0 volts (e.g., ground) for the logical 0.

It is necessary to use a signal converter to communicate between the two systems. Sparkfun Electronics (and many other places) sell these (https://www.sparkfun.com/products/449).

For you electronics gurus, I found inverting the signal with a simple NPN transistor circuit (with resulting voltage levels of 0 and 12 volts) also works for transmitting data from the Arduino to the RCP. A second circuit for transmitting data to the Auduino should also work, but I've not tested that. In any case, your mileage may vary.

Without a converter for the electrical signals the devices will never communicate and the mismatch may cause damage.

A good description of the issue is found at https://www.sparkfun.com/tutorials/215

John
Schumacher Taxi #189 racing team

View user's profile Send private message
Reply with quote
Post  
Thanks for the useful note. This isn't a problem, but actually a feature of the system; RS232 is the proper signaling when exposing serial data to the outside world; it would be bad if the raw 3.3v TTL signals were present on the external connector.

The RS232 transceiver step up the voltage so it can be broadcast over a longer distance, but also provide protection against surge / transient voltage spikes, as well.


_________________
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter
View user's profile Send private message Send e-mail
Reply with quote
Post  
Brent,

I agree 100% with you - RS232 is the proper interface for an external communications connector.

I was not trying to suggest any issue with the RCP - just explain a common misconception about serial communications protocols.

View user's profile Send private message
Reply with quote
Post  
Understood. No problem, and thanks for contributing!


_________________
Brent Picasso
CEO and Founder, Autosport Labs
Facebook | Twitter
View user's profile Send private message Send e-mail
Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum