Wireless autosteer program, easy to switch between USB and Bluetooth (with HC-05 bluetooth module)

Hello everybody,

As you probably already know it’s possible to use the autosteer via Bluetooth, it allow to get rid of one cable (and maybe a USB hub if your tablet have only one USB).

It is very simple and cheap to use HC-05 module, first, you have to configure it thanks to AT commands.
You’ll find various tutorial on the web about this to reach the configuration mode of the HC-05 so I leave you find this by yourself.

Here are the parameters I used to configure my HC-05 to made it working with AOG, if you have better, don’t hesitate to advice, parameters used with HC-05 firmware v3 (same for v2?):

Check firmware version: AT+VERSION
Slave mode : AT+ROLE=0
Make module visible : AT+CLASS=0
Connect with any adress type : AT+CMODE=1
UART parameters= Nano from autosteer : AT+UART=38400,0,0
Change the HC-05name : AT+NAME=Your_HC-05_name
Changer PIN code (default 1234 or 0000) : AT+PSWD= 1234

Note: During configuration, some AT commands will reset the HC-05 and get it out of configuration mode, to finish the configuration you need to return in configuration mode.

You can connect HC-05 on TX/RX of the Arduino Nano as it’s done usually, however it seem not possible to use USB (to upload a sketch or to read data) if the HC-05 is connected at this moment.

To make the system more versatile and allow to use the autosteer via Bluetooth or to go back to USB in case of problem, without physical disconnexion of the HC-05, I decided to make a separate serial from the USB hardware serial.

This software serial can be easily connected via the top Nano pin’s that are accessible even when your Nano is connected on the autosteer PCB.
It use pin 11 (MOSI), 12 (MISO) that are unused on the PCB and of course +5V and GND to power on the HC-05 (see on picture).
nano pinout

The dedicated sketch (adaptation from Brian sketch) must be uploaded to the Nano to allow to switch automatically betwen USB and Bluetooth serial.
USB is default mode, if no data on USB the program will try to read from Bluetooth serial connection (made for AOG v5.2.2).


Really good idea, but I have a question.
Can your ino select the right Bluetooth “com port” for nano, when there already are another Bluetooth “com port” for the F9p gps?

If I understand well you ask if the COM port of USB will be the same than bluetooth COM port?

Of course no, the .ino (so program in the nano) don’t deal with COM port, just windows do it, Bluetooth device when paired create two COM port (input and output but I’m not sure of the translation), it’s output port which must be used.

Example :

  • USB on COM3
  • BT input COM4 (unused)
  • BT output COM5

You select it via AGIO.

Thank you, I was just wondering what the automatic part did, as I already have several Bluetooth com ports.

Why don’t you use directly UDP, for me :
Wifi AP : (raspberry run rtkrcv)
Wifi STA : AOG on Surface
Autosteer (arduino nano)
Machine (indication of section status)
Led barr (indication of direction)

The automatic part just select on which serial (hardware via USB or software via Bluetooth) the program will run.
In clear, it detect which serial is active and use it (USB in priority), this allow to upload a sketch despite HC-05 is enable or to remain on USB autosteer in case of bluetooth failure.

1 Like

My main interest was to use bluetooth, as it simply create COM port and is easy to set without other equipment, also BT is a less powerful radio source (I confess it’s purely by safety, BT is just estimated less dangerous but the source is close so it seem important to me).

Hi, I’m trying to get STEER data via COM port. I can see some data but I don’t understand the frame. How to decode this data?
I can`t see modbus settings.

Thanks a lot.

It should be exactly the same data than over USB!
Are you sure TX from nano is connected to RX of HC-05 and RX to TX?

I must confess that after designing my own pcb box (Tranferable autosteer unit (TASU) by Blaise_fr - Thingiverse) I added a switch to turn off the 5V to the HC-05 that allow to use the USB in case of emergency (however to upload sketch via USB you need to disconnect TX or RX).
So I no more use that sketch which was specifically designed in case you don’t have place for that hardware solution.

Your job looks very good, congratulation.
I need to know what speed is via Machine COM 9600?
Also what type of protocol? Is that a UART or MODBUS?

“Machine” port that you select in AGIO is dedicated to tools operations like sections ON/OFF or position of the rear hitch if I remember well (I never used it).

This sketch in only about the “Steer” connection, via USB COM port OR via bluetooth COM port (from HC-05).
The baudrate sent to the HC-05 via the virtual serial is the same than for USB “classic” hardware serial connection “SerialBT.begin(38400);”.

I hope I understood well your question.

Yes you exactly understand my question. I need connect relays DC 12V 8 Kanal RS485 Relais Modul Modbus RTU UART Fernbedienung Schalter DIN35 C45 Schiene Box für PLC PTZ Kamera Sicherheit Monito|Relais| - AliExpress in to “Machine” port.
At this video Modbus RTU-Relaisboard als Teilbreitensteuerung für AgOpenGPS - YouTube I see there is MODBUS interface used - not Serial BT bauderate 38400. Maybe you are right, and COM sends AT Commands to HC-05, but whenever I`m connection “Machine” COM Tx in to COM terminal Rx never get decodated data.

Great idea to use the hc05.
I understand that the .ino file is programmed to use agopengps V5.2.2
A question With the available files (Autosteer_USB_v5_0_withBTserial_V2) and agopengps V5.2.2 Does everything work with the kaupoi v4.1 pcb?

Maybe I’m wrong but I don’t believe there is a compatibility problem between any version of v5 and any kaupoi.
Honestly I don’t use anymore this .ino, if you ensure a RELIABLE CONNECTION between hc05 and the nano, bluetooth work fine, you only have to disconnect it to upload a new program on the nano (and you don’t do this often).

I even use bluetooth for everything now (steer/canbus, f9p, imu).

1 Like

So you have a complete wireless aog? With al components?

Yes, as here AOG Transferable hardware!

A question. Could you send the .ino files you use?
I’m still new to Arduino programming.
I bought an HC-05
I configured the hc05 with a ch340 usb converter
What I’m missing is getting the Arduino .ino file right
Using AOG version 5.7.2
I’m having a connection problem, maybe it’s the .ino file
The autosteer works for a few moments and disconnects

Aog can disconnect for many reasons.
First two that come to mind.

If your speed go below the set minimum.
If you have set/use either current or pressure cut off.
Also do you test this in “drive mode”? (expand steering settings window/

My system is operational using a USB cable
Using a usb hub I have an error
And I have it when using in Bluetooth mode
The engine starts for a few minutes and disconnects with the usb hub and with bluetooth