I'm trying to recieve and decode hexadecimal communication between my amateur radio station and my computer. I tried using Serial.read and was expecting two numbers and a letter but I got a long constant instead looking a bit like this: 32767ul.
The baud rate is said to be 4800 between radio and computer and I tried with 4800 in serial monitor with mediocre results. What could be the problem?
Best regards Oscar
In addition to the other comments, especially since we don't know what your code is, make sure you are printing the results as a hexadecimal value like so:
Serial.print(num, HEX);
Where "num" is the number you want to print.
Also not sure where your skill level in Arduino coding is, but if you want each result on a new line, use the following function:
Serial.println(num, HEX);
If you want all values on the same line, but want spaces in between the values, you need to specify that. Sorry if you knew all of this already, but thought I should point it out just in case you didn't (we all started at one time).
For fun, if you don't want to print hexadecimal, you can swap "HEX" for "BIN" for binary, or "DEC" for regular ol' decimal (base 10).
I’m using a Arduino uno, but the whole task is only to receive hexadecimal serial data and then decode it. The computer asks the radio to send some of its operating data via one pin and the radio answers on another.
I’ve made a “bridge” using metal wire and made small loops to hook on to and receive radio or computer signal. (This will later on go to the same rx pin on the Arduino.
The contacts is RS-232. There’s quite a lot of information on how the communication is made on this website https://www.rigpix.com/yaesu/ft1000mp_manual.pdf
On page 73 and forward is information that goes in deep detail how to write an own computer interface for the radio. I know all the answers exist there but I’m completely new to serial communication with Arduino and don’t know what I supposed to look after.
For some reason can’t you use the link.
Use this link instead and scroll down a bit to find the user manual, there on page 73 is all the information that exists https://www.rigpix.com/yaesu/ft1000mp.htm
before attempting to connect the radio make sure you have the TTL-RS232 module connected to the UNO correctly by performing loopback tests, e.g. using a program such as
// AltSoftSerial transmit/Receive Test
//
// from https://github.com/PaulStoffregen/AltSoftSerial/blob/master/examples/ReceiveTest/ReceiveTest.ino
//
// Transmit data with Serial1 and try to receive
// it with AltSoftSerial. You must connect a wire
// from Serial1 TX to AltSoftSerial RX.
#include <AltSoftSerial.h>
AltSoftSerial altser;
const int mybaud = 19200;
// UNO connection to a RS232-TTL
// UNO PIN 8 to RS232 RXD
// UNO pin 9 to RS232 TXD
// Board Serial1 TX AltSoftSerial RX
// ----- ---------- ----------------
// UNO/nano 9 8
// Teensy 3.x 1 20
// Teensy 2.0 8 (D3) 10 (C7)
// Teensy++ 2.0 3 (D3) 4 (D4)
// Arduino Leonardo 1 13
// Arduino Mega 18 48
// Serial1 on AVR @ 16 MHz minimum baud is 245
// Serial1 on Teensy 3.2 @ 96 MHz minimum baud is 733
void setup() {
delay(200);
Serial.begin(115200);
while (!Serial)
; // wait for Arduino Serial Monitor
altser.begin(mybaud); // to AltSoftSerial RX
Serial.println("\n\nAltSoftSerial transmit/ Receive Test");
Serial.println("on a UNO connect pins 8 and 9 for a loopback test");
Serial.println("using RS232 module connect pins 2 and 3 for a loopback test");
Serial.println("characters entered on serial monitor keyboard are echoed back via serial to the display");
}
void loop() {
// transmit a test byte on Serial 1
if (Serial.available() > 0) {
altser.write(Serial.read());
}
// attempt to receive it by AltSoftSerial
if (altser.available() > 0) {
Serial.write(altser.read());
}
}
run the program connecting pin 8 to pin 9 to form a loopback - characters entered on the keyboard should echo back to the display
when that works connect the TTL-RS232 module
// UNO PIN 8 to RS232 RXD
// UNO pin 9 to RS232 TXD
to test link pins 2 and 3 to form a loop back
again characters entered on the keyboard should echo back to the display
a quick check of RS232 connections with nothing connected is to measure the voltages on pins 2 and 3 - female 9 pin D-type transmit (pin 2 above) should be -6 to -12Volts receive (pin 3) should be 0volts
what baudrate is the radio - a UNO using bit-bash software serial code has trouble over 38400baud
I’ve only started to brainstorm and tested with a simple code to read serial and found that it would be harder than I thought. I’m going post the code later on
Here you have the code. As I said, it was only made for testing as simply as possiple. Coding is atleast half, if not more, in your head before you start. This is a coding forum and is for people who want help from others with coding arduino. That also includes the though process before and while you code.
Regarding the code you won't post, from the information I linked you to earlier,
Please try to avoid posting links to other sites where code or photos or schematics are hosted. Most of us will not follow such links, partly due to the risk that they hold malware or other unwanted content, partly to maintain everything on this site for the benefit of future users looking for an answer to a similar question, and partly because we feel that if you want our help you should provide everything we need on this site not expect us to go hunting elsewhere for it.
It's clear that you must have extracted the code from that humungous PDF in order to test it, yet you want us to do the same thing, including making edits to the code if necessary to make it work for your hardware, as we imagine it. Why? You have the code in front of you. If you're not willing to do a cut and paste from the IDE to a message here, why should we put much more effort into attempting to recreate some form of what you're telling us doesn't work? I don't get it.
Good luck with your project; for me, there are other new members to help.
AH, I see you've added it now. Thank you.
Thank you for your answer. I did not use a special RS232 card to balance the voltage therefore it did not work. I didn't see that you needed that module anywhere. I've now bought it. Thank you so much for your help
Okay. Post #10 outlines what you may be fighting, though I'd like to know what mediocre results" means for your testing. What I see in your code should work, so odds are it's a hardware issue.
do you have an RS232-ttl level shifter? If no, you need one. If yes,
do you have GND, TX, and RX connected properly? Please, a picture of your connection, as I don't 'see' GND mentioned in your text. If you have all 3 lines connected,
do you know the number of bits, parity, and stop bits for the device being connected? This may be a case where you need something different from what Arduino defaults to.