We seek to understand and document all radio transmissions, legal and otherwise, as part of the radio listening hobby. We do not encourage any radio operations contrary to regulations. Always consult with the appropriate authorities if you have questions concerning what is permissible in your locale.

Author Topic: I need some help writing some arduino code for RS232  (Read 6818 times)

Offline redhat

  • DX Legend
  • ******
  • Posts: 1585
  • USA
  • Music is my drug.
    • View Profile
    • Email
I need some help writing some arduino code for RS232
« on: September 04, 2019, 2100 UTC »
This could very well become a community project.  See related video here https://youtu.be/EwMDEjv1Hfc  I have built a DDS based VFO, but need some way to control it once embedded in the bowls of various pieces of equipment.  The basic idea is this; the project listens to an RS232 port for valid commands.  if it receives something like "f=6925<CR>" the VFO output frequency is set to 6925 KHz and echos "f=6925<CR>".  It would also be nice if other commands like "RF ON", "RF OFF" and "f+5", +10, etc could be implemented.

I've looked all over and haven't really found anything like what I need.  The biggest problem seems to be how to get the serial data into a string, and then begin processing it once it detects a carriage return.  if/then/else statements could then be used to carry out the desired functions.

Thanks in advance,

+-RH
Somewhere under the stars...
Airspy HF+, MLA-30/Mini-whip/Chi-Town Loop
Please send QSL's and reception reports to xfmshortwave [at] proton [d0t] me

Offline JimIO

  • Sr. Member
  • ****
  • Posts: 491
  • QTH I.O. MA
    • View Profile
Re: I need some help writing some arduino code for RS232
« Reply #1 on: September 04, 2019, 2308 UTC »
People have done that, search 'arduino ad9850'.
If you want to start from scratch search 'arduino serial.begin(9600)'.

Offline redhat

  • DX Legend
  • ******
  • Posts: 1585
  • USA
  • Music is my drug.
    • View Profile
    • Email
Re: I need some help writing some arduino code for RS232
« Reply #2 on: September 04, 2019, 2346 UTC »
Quote
People have done that, search 'arduino ad9850'.
If you want to start from scratch search 'arduino serial.begin(9600)'.

I've been down that road many times and have not found anything close to what I'm looking for.  If your so sure its out there, you could bring a link.

+-RH
Somewhere under the stars...
Airspy HF+, MLA-30/Mini-whip/Chi-Town Loop
Please send QSL's and reception reports to xfmshortwave [at] proton [d0t] me

Offline OgreVorbis

  • Full Member
  • ***
  • Posts: 141
    • View Profile
    • DosaidSoft
    • Email
Re: I need some help writing some arduino code for RS232
« Reply #3 on: September 05, 2019, 0622 UTC »
This could very well become a community project.  See related video here https://youtu.be/EwMDEjv1Hfc  I have built a DDS based VFO, but need some way to control it once embedded in the bowls of various pieces of equipment.  The basic idea is this; the project listens to an RS232 port for valid commands.  if it receives something like "f=6925<CR>" the VFO output frequency is set to 6925 KHz and echos "f=6925<CR>".  It would also be nice if other commands like "RF ON", "RF OFF" and "f+5", +10, etc could be implemented.

I've looked all over and haven't really found anything like what I need.  The biggest problem seems to be how to get the serial data into a string, and then begin processing it once it detects a carriage return.  if/then/else statements could then be used to carry out the desired functions.

Thanks in advance,

+-RH

Maybe this would help:
https://arduino.stackexchange.com/questions/48333/very-basic-arduino-uno-serial-readstring-operation
Radio and Programming Blog: http://dosaidsoft.com/wp/

Offline Monophonia

  • Jr. Member
  • **
  • Posts: 32
    • View Profile
Re: I need some help writing some arduino code for RS232
« Reply #4 on: September 06, 2019, 1449 UTC »
You described your solution, reading strings as they come over the serial bus.

A few years ago I made a bit of arduino code that read a character from the serial line and did a simple action (relay open, relay close, relay position, etc) I can probably dig up the code from that given time.

In my DDSVFO implementation, I use SI5351a boards since they make a nice strong square wave. They talk to the arduino using I2C. I also use an I2C/HD44780 adapter to drive the display to save I/O on the arduino. The display and Si5351a sit on the same bus, then the rest of the arduino pins are free for buttons, relays, and A/D inputs. My "brain board" uses a single arduino and has enough I/O to drive T/R and sequencing relays, 4 ADCs to sample current, voltage, power, etc. My low level PWM modulator sits on the same board as well.

You have my number, send me an email and I'll share more details.

Offline Josh

  • DXing Phenomena
  • *******
  • Posts: 4322
    • View Profile
Re: I need some help writing some arduino code for RS232
« Reply #5 on: September 06, 2019, 1810 UTC »
We do not encourage any radio operations contrary to regulations.

Offline redhat

  • DX Legend
  • ******
  • Posts: 1585
  • USA
  • Music is my drug.
    • View Profile
    • Email
Re: I need some help writing some arduino code for RS232
« Reply #6 on: September 16, 2019, 1440 UTC »
A couple of people sent me some links that were helpful, and I'm also working with another guy on here to further develop some of the transmitter control system.

Thanks all,

+-RH
Somewhere under the stars...
Airspy HF+, MLA-30/Mini-whip/Chi-Town Loop
Please send QSL's and reception reports to xfmshortwave [at] proton [d0t] me

Offline JimIO

  • Sr. Member
  • ****
  • Posts: 491
  • QTH I.O. MA
    • View Profile
Re: I need some help writing some arduino code for RS232
« Reply #7 on: September 22, 2019, 1428 UTC »

"I've been down that road many times and have not found anything close to
what I'm looking for.  If your so sure its out there, you could bring a link.


+-RH"

Sorry for the delayed response, isp problem.
Why do you want to use RS232, for remote control?
Why not a lcd 1602 keypad shield?
What aduino and dsp are you going to use?
I have some uno clones and prototype boards and a ad9830
and ad9850 module that I got for something like this.
I'd like to be part of the project.


Offline redhat

  • DX Legend
  • ******
  • Posts: 1585
  • USA
  • Music is my drug.
    • View Profile
    • Email
Re: I need some help writing some arduino code for RS232
« Reply #8 on: September 22, 2019, 1820 UTC »
The control point and transmitter will be separated by some distance, and a RS232 link exists between those points.

+-RH
Somewhere under the stars...
Airspy HF+, MLA-30/Mini-whip/Chi-Town Loop
Please send QSL's and reception reports to xfmshortwave [at] proton [d0t] me