AgOpenGPS How to build Section Control

Andy26

Moderator
Arable Farmer
Location
Northants
Intro

As well as guidance and autosteer, AgOpenGPS is extremely good at auto section control or Machine control as its referred to.

You can control an implement lifting in and out of work on the headland, tramlines engaging and disengaging and turning on and off sections of a sprayer, spreader or seed drill.

You do not need to have installed Autosteer, you just need a Windows 10/11 tablet, an RTK receiver and antennae, like this:

basic-kit-upgraded-600x600.jpg


And to download the AgOpenGPS software from here:


The Parts

So assuming you have AgOpenGPS setup, be it full autosteer or just guidance you need to build a 'Machine module', so first off we need an Arduino, the code is principally written for an Arduino Nano, (but will work with other Arduino boards but may need minor alterations to reflect the differing number of pin outputs).

So you need to buy one of these:

1699349480574.png


Next you need a way of connecting to the Pins on the Arduino, so we need a shield like this:


71jYoA6nnPL._SX522_.jpg


You'll then need a relay board, if you have a 4 section sprayer you will need 4 relays (however some reverse polarity sprayers will need 2 per section, so 8 relays for 4 sections), we want 5V relays as we will be using the 5V output from the Nano to power it.

51-cZLkSD4L.jpg



Will also need some Dupont cables to connect the shield to the relay board, like this:

71J5Z1gF-HL._AC_SX425_.jpg


You will also need a mini USB cable.

The Build

So first place the Arduino Nano into the Shield, taking care to match the pin labels. So each pin on the Arduino has a screw terminal on the shield.

We can power the Nano in two ways, via the USB cable or via the Vcc and GND pins, in this example we will use USB, since we will be using that to communicate with the AgOpenGPS Software. As we are only operating 4 relays the Nano onboard 5V is comfortably able to handle this, but if powering more relays you should power the relay board with a separate supply.

We then need to use the Dupont cables to connect the Nano pins D13, D5, D6 and D7 with In1, In2, In3 and In4 respectively.

We are also going to use the Arduinos 5V output to power the Relay board, so connect a cable to 5V and Ground and connect these to the Vcc and GND pins on the relay board, like this:

PXL_20231107_094723831.jpg



So moving to the relay board, each relay has 3 connections:
COM- Common, this is connected to NC when the relay is not powered and to NO when the relay is activated
NO- Normally Open, this is isolated when the relay is not powered and connected to COM when the relay is powered
NC- Normally Closed, this is connected to COM when the relay is not powered and isolated when the relay is powered

So for this example our sprayer needs a 12V constant input or signal to turn on, so we are going to put 12V to all the COM terminals, in this example I'm using a 5 way Wago connector to distribute an incoming 12V supply to the relays.

We only want the sprayer to receive 12v when the relay is activated so will put a wire into the NO terminal and connect this to the sprayer section on/off switch.

Its entirely up to you how you do this, you could put in NC and need the relay activated to turn the sprayer section off, this is a fails on system, which IMO is not good for a crop sprayer, always prefer fail safe/off. We can invert the relays in the software to our preference.

PXL_20231107_103817382.jpg


In this example we are controlling a Knight 24m crop sprayer with 6m sections, the sections are switched by a SPST switch that sends 12V to the sprayer valve, which is a SAFI valve with integrated relay. We will replace the switches in the cab mounted control box with SPDT switches, like this:
1607958-40.jpg


The middle terminal on the switch will go to the sprayer valve, the top pin will be connected to the 12V supply in the sprayer control box and the bottom terminal we will connect to with our cable from the Relay NO terminal. In this example the RDS Delta rate controller is spliced into the middle terminal so will receive a signal to tell the rate controller which sections are turned on.

Repeat for the other three sections.

So in this example switch up is manually On, middle is Off and bottom is AgOpenGPS section control. So in practice if spraying manually with AgOpenGPS not operating the middle and bottom positions are off.

Firmware

We now need to install the firmware on the Arduino Nano, to do this you need to download Arduino IDE


There are countless tutorials and YouTube videos online of how to install firmware or sketch as its known onto an Arduino, so will skate over it.

You need to go to the AgOpenGPS firmware repository here:


And download it, then locate this file in the Arduino modules USB folder:

1699351809403.png


Open the file in Arduino IDE, connect your Nano via USB, select the correct COM port and then click on Upload, you now have the firmware installed.

So we need to connect our machine module via USB cable to our tablet.
It doesn't matter if you are using AgOpenGPS via Ethernet/UDP you can mix and match.

So in AgIO go to the serial connections and connect the Machine module:

1699352217329.png


1699352239359.png


You can see here the Machine module is connected on COM 21.

When you plug the USB cable into the tablet/computer, you will hear the relays operate as the Arduino software starts to run, they will toggle, this is perfectly normal.

In the AgOpenGPS settings you need to assign each section to a Pin:

1699352553250.png


You can have a play in the house/office in Simulator mode with your module plugged in, the relay boards have led lights to indicate when they activated and you will here them clicking.

So that's a quick guide, you then need to put all your parts in an enclosure, like this:

PXL_20231107_094733388.jpg



That Arduino shield and relay board are held in place on plastic PCB stands like this, that are epoxy resins to the enclosure:

images.jpeg


Then there is a USB panel mount cable like this:

61n5WaWeHbL._SX522_.jpg

 

Attachments

  • 1699352502043.png
    1699352502043.png
    57.2 KB · Views: 0
Last edited:

SamN

Member
Mixed Farmer
Location
Cornwall
Great work, the AOG website has been missing some good tutorials like this. How about operating the tractor linkage and electric spools?
 

andyinv

Member
Great work, the AOG website has been missing some good tutorials like this. How about operating the tractor linkage and electric spools?
That's always been a problem - some people have done some amazing things out there, but usually in isolation, to solve their own problem. And they don't write it up in Success Stories and the info kinda gets lost. While any number of people will jump in and go "yeah, I've done that weird setup already!" and help out if you ask, you're dependent on them seeing your question in the first place.

I'm finishing a CVX over CANBUS hopefully this weekend, the details of which will be online soon. But I had to go asking why I was getting WAS errors, and then find out how to get into the tractor's diagnostic menu, run a WAS calibration and enable autosteer in there first. If more people would write stuff up, it would bring more people in when they see what it can really do. A "how I did this" is worth 100 manuals, imo.
 

Andy26

Moderator
Arable Farmer
Location
Northants
You can do a lot with section control... I hadn't seen this video until just now:
@Briantee first developed AgOpenGPS to do section control on his seed cart, so it's always had section control at its heart, there are so many good settings and controls you have for section control.
Probably needs a tutorial in itself, lots of things you can do, spray the headland first or last, set time delays, turn off when a set percentage of section is sprayed, turn off if boom travels beyond boundary, change coverage colours, raise sprayer boom on entering headland etc etc
 

Tim G

Member
Livestock Farmer
Thinking that this might make a nice project for myself and the boy over Christmas. I've a 3 section sprayer with the reverse polarity type valves so if I need 6 relays is it a case of buying a block of 8 relays and I guess some how programming it to operate two relays for each section, or having two sets of four relays and wiring them in parallel so that they both work together and have one set to switch the +ve and one set for the -ve? I'm assuming the relays only come in twos, fours and eights etc?
 

Andy26

Moderator
Arable Farmer
Location
Northants
Thinking that this might make a nice project for myself and the boy over Christmas. I've a 3 section sprayer with the reverse polarity type valves so if I need 6 relays is it a case of buying a block of 8 relays and I guess some how programming it to operate two relays for each section, or having two sets of four relays and wiring them in parallel so that they both work together and have one set to switch the +ve and one set for the -ve? I'm assuming the relays only come in twos, fours and eights etc?
Yes 6 relays needed, so an 8 relay board will give you two spares.
To operate two relays at the same time, just T the signal wire from the Arduino to operate both relays simultaneously.

If 2 Wire valves, with limit switches, wire as follows:

Relay 1:
NC to 12V
NO to: GND
COM: valve motor cable A
Relay 2:
NC: GND
NO to: 12V
COM: valve motor cable B

Don't wire these in parallel with the original manual switches, otherwise at some point you will accidentally short 12v to ground when you have you have a switch in the wrong position.
 
Last edited:

Tim G

Member
Livestock Farmer
Yes 6 relays needed, so an 8 relay board will give you two spares.
To operate two relays at the same time, just T the signal wire from the Arduino to operate both relays simultaneously.

If 2 Wire valves, with limit switches, wire as follows:

Relay 1:
NC to 12V
NO to: GND
COM: valve motor cable A
Relay 2:
NC: GND
NO to: 12V
COM: valve motor cable B

Don't wire these in parallel with the original manual switches, otherwise at some point you will accidentally short 12v to ground when you have you have a switch in the wrong position.
Yep, switch wiring will take a bit of thinking about. I've found a six relay board, hopefully that would keep it neater.
 
We have a Team sprayer that I will be converting to section control using this information. I am also interested in using rate control option, is this something you have done or are looking at as well? I have been looking myself but cannot find a "do it this way" instruction.
 

Andy26

Moderator
Arable Farmer
Location
Northants
We have a Team sprayer that I will be converting to section control using this information. I am also interested in using rate control option, is this something you have done or are looking at as well? I have been looking myself but cannot find a "do it this way" instruction.
Yes I'm doing rate control as well, see this post:

https://thefarmingforum.co.uk/index.php?threads/agopengps-rtk-autosteer-how-to-guide-for-£1000.382244/page-23#post-9082527

Will be back on it next week, have some spare rate control PCBs as well, can have a PCB at cost or can build a PCB up with a Teensy and Cytron for not much more.

@moldengineer do you have AgOpenGPS running at the moment for guidance?
 
No I dont have agopengps for guidance, tractor is equipped with JD ATU, 6000 dome and 1800 screen. Am going to use agopengps for section control and ideally rate control as well.

The sprayer has a pressure based system on it at the moment and i need to see if the section motors are 2 wire or 3 wire. Looks like i need a flow meter installed instead of the pressure sensor? Would be interested in a built up board.
 
Last edited:

Andy26

Moderator
Arable Farmer
Location
Northants
No I dont have agopengps for guidance, tractor is equipped with JD ATU, 6000 dome and 1800 screen. Am going to use agopengps for section control and ideally rate control as well.

The sprayer has a pressure based system on it at the moment and i need to see if the section motors are 2 wire or 3 wire. Looks like i need a flow meter installed instead of the pressure sensor? Would be interested in a built up board.
I think PCB board has a pressure input, but I've seen no reference to using this for rate control.

Take a picture of your valves and the inside of the cab control box if you can.
 

SFI - What % were you taking out of production?

  • 0 %

    Votes: 107 39.6%
  • Up to 25%

    Votes: 100 37.0%
  • 25-50%

    Votes: 40 14.8%
  • 50-75%

    Votes: 5 1.9%
  • 75-100%

    Votes: 4 1.5%
  • 100% I’ve had enough of farming!

    Votes: 14 5.2%

May Event: The most profitable farm diversification strategy 2024 - Mobile Data Centres

  • 2,707
  • 49
With just a internet connection and a plug socket you too can join over 70 farms currently earning up to £1.27 ppkw ~ 201% ROI

Register Here: https://www.eventbrite.com/e/the-mo...2024-mobile-data-centres-tickets-871045770347

Tuesday, May 21 · 10am - 2pm GMT+1

Location: Village Hotel Bury, Rochdale Road, Bury, BL9 7BQ

The Farming Forum has teamed up with the award winning hardware manufacturer Easy Compute to bring you an educational talk about how AI and blockchain technology is helping farmers to diversify their land.

Over the past 7 years, Easy Compute have been working with farmers, agricultural businesses, and renewable energy farms all across the UK to help turn leftover space into mini data centres. With...
Top