Thursday, 28 December 2023

Patriot 4430 DIY Raven-style Recirculation System

Recirculating Booms

For a good introduction to recirculating booms, see this excellent article by Tom Wolfe.

We ultimately decided to implement our own DIY solution, based on the Raven recirculation kit for the 4440 sprayer. The plumbing looks like this:

We chose this solution for several reasons:

  • Did not require major replumbing other than on the boom itself and a return line to the tank.
  • Maintained the ability to use the non-PWM nozzle bodies for things like fertilizer, since the section-control valves remain.

How it works

This system is more of a boom-priming system than a recirculating system, whichs is all I really wanted. The goal is to get fully-mixed product solution through all the boom sections without spraying anything on the ground, wasting it.

Circulation is done in several steps. With the Raven kit, the rate controller automatically does all these things when the mode switch is set to "recirculation.":

  • Electric return valve is opened, allowing the boom return lines to flow back to the main tank.
  • Outer-most two section valves are opened, allowing solution to flow from the outer ends of the booms, through all the sections to the inner-most ends, and then back to tank. This primes the majority of the volume.
  • The remaining section-control valves are cycled on to allow solution to prime the remaining volume between the valves and their sections.
  • Center section is primed separately.
  • Electric return valve is closed.

General Plumbing

As described in the Raven installation pdf, there are several parts to the installation.

On the center rack a throttling valve and an electric ball valve are mounted, and a return line from the electric valve back to the main product tank. A stainless fitting may need to be added on to the top of the tank. The purpose of the throttling valve is to choke the return flow down to keep the boom pressure up during recirculation/priming. Otherwise the pump will race as it tries to hold constant pressure.

The outer-most section-control valves are replumbed so that they feed the section from the outer-most ends of the sections rather than the middle. The remaining sections are tied together with hose and isolation valves (normally kept open). The isolation valves allow operating the sprayer conventionally, without the PWM nozzle bodies for applications such as liquid fertilizer. Obviously if the isolation valves are closed, recirculation is not possible.

The inner-most ends of the left and right booms, as well as the outer ends of the center section are all teed together into the return valves and line added.

Raven has a complete parts list in the installation PDF linked to above.

Differences From Raven's Setup

The Raven add-on system requires the 4440 or 4450 sprayer, as it integrates with the ISOBUS Raven Rate Controller to automate all the steps of boom circulation. Since I don't have the Raven ISOBUS controller I have to cycle the boom valves individually with a bank of switches on my console, which I'll explain below.

Plumbing

I made several minor changes compared to Raven's offical parts list:

  • inter-section fittings and hose were changed to 1" instead of 1-1/4". 1" hose was far easier to work with, and I could not see any real downside. During normal operation fluid doesn't flow through these hoses, so choking them down a bit would only slightly slow the recirculation.
  • The return line to the tank used 3/4" hose, and the throttling valve was unnecessary. I calculated that the flow restriction through 3/4" hose would keep the pressure up instead of needing to choke the valve down. This has proven correct, although the maximum flow rate back to the tank during recirculation is about 22 gpm at 60 psi, so the initial circulation through the outer-most sections needs to be about 20-30 seconds to get complete circulation. After that each additional set of sections can be cycled in sequence to flush out the bit of hose between the section valves and the boom itself.

Electrical

As I do not have the Raven ISOBUS rate controller to automatically do the valve cycling, I had to implement that part with switches and relays. On the main rack there are two bundles of wires that feed the section valves. One bundle does sections 1-3 and the other bundle does sections 4-7. The actual signal wires are white and activate the section when 12V is on the wires. Each bundle is connected through a Deutsch DT-12 plug junction. I made some pigtails that are inserted into these junctions and pass all the wires straight through except the white section signal wires. Those are taken through a harness to my relay box. In addition 12V keyed power is pulled through the pigtail from one of the DT plugs to operate the relay coil.

The relay box consists of 5 relays that have the following type and function:

  1. SPST, Recirc return solenoid valve
  2. DPDT, Section valves 1 and 7
  3. DPDT, Section valves 2 and 6
  4. DPDT, Section valves 3 and 5
  5. SPDT, Section valve 4

The relays pertaining to the sections are all wired such that common terminals are connected to the white wires that go directly to the section valves. The normally-closed terminals are connected to the white wires that bring the section-control signals from the sprayer. In this way when the recirculation system is not running, the section valves are all still controlled normally from the sprayer through those white wires. Of course as long as the inter-section isolation valves are open, solution can still pass through to the "off" sections, so section control is ultimately done by the PWM shutoff valves anyway. However if the isolation valves are closed, the sprayer can operate exactly the same as it did before any recirc plumbing was done, so conventional spraying can be done without using the PWM Aim Command system.

The SPST recircl valve relay is wired such that common terminal is fed with 12V keyed power from the pigtail, and the normally-open terminal is connected to the 12V recirc ball valve, and also to the normally-open terminals of all the section valve relays described above. The reason for connecting the output of this relay to the other relays will be made clear in a moment.

The DPDT section valve relays are connected as follows: The common terminals connect to the white wires that go directly to the section valves. The normally-closed terminals connect to the white wires that go to the sprayer side. The normally-open terminals connect to the normally-open terminal of SPST recirc valve relay.

A cable bundle is run to the cab to connect to the control switches added to the console. There are two ways of wiring the switches to control the relays. One method is to send one 12V wire to the cab and then bring back five switched wires to each relay and then to ground. The other method is to wire the coils all in parallel to 12V in the relay box, and then send wires from the other side of each relay to the cab and have the switches connect them to ground. Either method works. I chose to use the second method because in the future I want to automate the recirculation process with a microcontroller, eliminating all the switches, and making it function much more like the Raven, integrated system.

Because of how the relays are wired, if the the recirc valve is off, switching on any of the section recirc switches will actually cause the valve to turn off if it is on and you were spraying. This is actually something I did on purpose, as it assists with continuous rinse, which I describe in another post.

Cab switches

I ran a multi-conductor cable from the relay box on the back of the sprayer down the lift arms and along the frame, into the cab through the right-hand door (there are grommets for this purpose), behind the seat, and into the armrest. I 3D printed some little plates to mount the switches in a blank in the armrest console.

My Recirculation Procedure

My procedure is manual, but it does not take long and is not difficult.

  1. Turn up pressure to at least 60 psi in Aim Command
  2. Turn on recirc valve switch
  3. Turn on recirc Section 1 and 7 switch for at least 30 seconds and then off. This does the vast majority of the priming.
  4. Turn on recirc Section 2 and 6 switch for at least 20 seconds and then off. This primes the little section of hose between the valve and the section itself, and then flushes that bit back through to the tank.
  5. Turn on recirc Section 3 and 4 switch for around 20 seconds and then off.
  6. Turn on recirc Section 4 switch for 10-15 seconds and then off.
  7. Turn off recirc valve switch. Important!

Future Automation

In the future I plan to use a micocontroller to automate the recirculation procedure so that only a single switch would be needed, making my DIY system function like the original, integrated Raven kit.

Tuesday, 26 December 2023

Patriot 4430 or 4440 Continuous Rinse

What is "Continuous Rinsing?"

Continuous rinsing is a technique for washing the tank on the fly, while still in the field, diluting the herbicide concentration in a sprayer's tank and plumbing to the point that it is safe to switch herbicides and target crops without risk of damage to the plants. On their blog, the guys at Sprayers101 describe several techniques for implementing a continuous rinse system on several kinds of sprayers. The idea is to start pumping clean water from the rinse tank into the main tank rinse system after the main tank is mostly empty and while still spraying. This begins to dilute the solution left in the tank and spray it out. After the rinse tank is empty, enough water has passed through the sprayer to make it safe to switch chemicals with minimal cleanout (emptying boom cleanouts mainly).

Usually this is accomplished by adding a second pump with sucks from the rinse tank and sends water directly to the tank rinse nozzles. Such a pump needs to be able to keep up with the flow rate of normal spraying. This keeps the main pump from sucking air. This rinse pump could be hydraulic, or it could be electric.

Here is a picture illustrating the principle from the Sprayers101 web site.

Product Solution Tank Level Sensor

Key to continuous rinsing is knowing exactly how much solution water is in your main product tank. Tank rinsing begins when the solution tank is nearly but not quite run out. And it's important to adjust spraying speed to ensure the rinse water is spraying down the tank at about the same rate as it is being pumped out. I feel that a tank level sensor is essential. We use a system called Accu-Volume, but there are other systems out there, such as this one from Nozzle Ninja.

Hydraulic Pump

We decided to use a hydraulic pump since we had a spare one, taken from an old pull-type sprayer. It is not exactly the same as the 4430's product pump, but very similar in capacity. We used a Hypro 9306-HM1C (the sprayer's pump is a 9303-HM1C--not sure what the difference is.

Following the instructions described by Sprayers101, we plumbed in hydraulic lines as shown in the picture below. The pressure comes from the main aux pressure line that comes from the right-hand, pressure-compensated pump. The return to tank tees into the hose coming from the product pump valve. The return to tank lines all ultimately end up in a common manifold on the 4430, which runs through hydraulic cooler and back to the tank.

To control the pump, I used a simple two-way solenoid control valve from Princess Auto. A switch on the console runs a relay that send 12V to the hydraulic valve solenoid. The pressure line feeds on port of th solenoid valve and the other port goes through a needle valve and into the pressure port of the Hypro pump.

Initially I found that the rinse pump ran so fast that even at a low idle the water pressure was well over 100 psi. I added a needle hydraulic flow control valve to the pressure side of the pump's motor, allowing me to dial in the pump speed and pressure I need. With the needle choked down to at most 25% open, at full throttle the rinse pump is running at around 90 psi water pressure and can pump about 30-40 gpm through the tank rinse nozzles, which seems to work well for spraying 10 gpa between 10 aand 13 mph. Any more flow than that would require drilling open the rinse nozzles in the tank.

Mounting the pump

I made a custom piece of C channel 4' 8" wide that sits on the frame rails between the tank and the engine pod, which is bolted to the frame with U bolts. I hung the pump pump from this channel. The pump mount is a piece of angle iron, angled slightly so that the discharge line makes a nice angle up towards the top of the tank.

Electical wiring

The electric hydraulic valve mentioned above is controlled with an automotive relay. I brought fused power directly from the battery box main power bus to the common pin of the relay. The solenoid for the hydraulic valve has one wire connected to the normally-open pin, and the other wire going to ground. In the console of the cab I found a source of fused, keyed power that runs through a toggle switch I added to the console. From the switch it runs back to the coil of the automotive relay, and then to ground. So control is very simple, and can be tested when the engine is not running. The solenoid hydraulic valve has a little light on it when it's powered on. And there should be an audible click when the shuttle moves inside the valve.

Plumbing

To begin with, we weren't sure if the factory rinse system would still be useful to keep or not, so I plumbed the rinse pump to run in parallel to the factory rinse system. In my estimation, the original hoses bringing fresh water out of the bottom of the rinse tank were too small to handle the volume needed for continuous rinse, so I replaced them with 1-1/4" hoses and fittings, which come together. I added a filter to the rinse take suction line, and teed it to go to both the factory rinse circuit and the new rinse pump. I use 1-1/2" line to take the fresh water down to the rinse pump intake.

To keep the factory rinse plumbing intack, I put a tee after the filter I added, and connected the original line as well as my new rinse-pump intake line. However I haven't once used the factory rinse plumbing since I installed the continous rinse system. If this pumbing were all removed, it would greatly simplify the mess of pipes between the tank and the radiator.

The discharge of the rinse pump runs to to a check valve on the tank-rinse nozzles fitting on the solution tank. Because the fresh-water tank is above the product thank, it is necessary to run the rinse pump discharge hose up above the top of the rinse tank and then back down to the tank rinse. At the top of the loop, I used an irrigation air control valve to break the syphon. Otherwise the rinse tank will slowly empty itself into the solution tank, even with a check valve. The check valve is necessary to prevent solution from entering the fresh water discharge line when the tank is full.

I chose to put a tee on the tank rinse nipple and keep my factory tank rinse system connected in addition to the tee coming from my new continuous rinse pump. However in the years I've been using this system, I've never once used the factory rinse system.

I also ran a little 1/4" line from the volute of the pump to a water pressure guage I mounted outside the cab so I can monitor the pump pressure as I'm rinsing, and be able to tell when the rinse pump is running out of water. Possibly one could add some kind of pressure switch in series with the automotive relay coil to shut the pump down automatically when the pressure dropped, to save the pump seal.

Rinse procedure

When the solution tank is nearly empty, a switch on the armrest turns on the rinse pump which begins washing the tank down with clean water, which is sprayed out. During this time the sparge valve is cycled, or at least opened slightly to clean it out with diluted rinse water. After the contents of the rinse tank have been washed through the main tank and sprayed out, the sprayer is mostly clean and any chemical remaining is diluted to safe levels. Any dead spots (boom ends, for example) still need to be cleanened out, however, although with a Pommier or Nozzle Ninja -type boom circulation system, there are no dead spots to worry about and all the plumbing should now be clean, as well as the tank.

Interaction with the Raven recirculation add-on

If the sprayer has the Raven boom-prime recirculation kit installed, there are a few things that need to be done while rinsing to ensure the system is as clean as possible. Since the Raven kit keeps the section-control valves in place while still connecting the ends of each section together, we have to ensure that these inter-section hoses are flushed. To do this, run out about half the rinse water normally. Then stop and let the rinse pump fill the main tank with about 30 or 40 gallons and turn off the rinse pump. Sitch on the circulation system and let the dilute solution circulate through all the booms and the hoses between the sections and back to the tank. Then spray that out. Possibly repeat the circulation process a second time

Rinsing with my DIY recirculation System

My DIY recirculation system is based on Raven's add-on system, so I also require additional steps to clean out the booms, hoses, and fittings. With the sparge valve cracked open slightly, I rinse and spray at least 60 gallons of fresh water. While doing this, I hit the special recirc section buttons on my console, one at a time, keeping the main recirc valve switch off. With the recirc valve switch off, this will cause the section-control valves to cycle to the off position, one at a time. When a particular section-control valve is off, diluted solution from the neighboring sections will flow through the inter-connect hoses, cleaning them.

After spraying out at least 60 gallons of rinse water, I stop spraying, and let the rinse pump fill the tank with 30-40 gallons of fresh water and then stop the rinse pump. Then I run through the recirculation procedure which involves turning on the recirc valve switch, and then cycling through the recirc valve switches. Once this is done, I spray out what's in the tank. Then I turn the rinse pump back on and spray and rinse the remaind of the water in the rinse tank.

Saturday, 30 October 2021

MacDon Header Adapter Sprocket Tension Keeper

Tensioning the chain that drives the center drum on a MacDon CA20 or CA25 header adapter leaveas a lot to be desired. Tightening is just by holding the idler with a prybar and then tightening a bolt in a slot. However, once you reverse the feederhouse, the force on the chain inevidably drags the idler down in its slot, loosening the chain. After that it gets progressivly looser every time you have to reverse.

My brother designed a simple keeper plate to remedy this. This keeper plate replaces the washer under the nut, and has a spiral track in it. This keeps the idler locked wherever you set the idler tension. It's made out of 1/8" plate steel with a short piece of rod acting as a sub welded to it. We cut out the spiral with a CNC plasma table, but it is simple enough to cut by hand.

Here's a image from the parts breakdown that shows where the keeper is fitted.

The keeper is a pretty simple affair, made out of 1/8" steel plate, with a bit of a stub welded in that pushes down in the slot and keeps everything where it should be:

A PDF template you can print out and use to mark the steel to cut is here. Also available is a 2D CAD dxf file.

Tuesday, 9 March 2021

Starfire 3000 TCM, What It Is and How to Fix

Starfire GPS receivers have a built-in terrain-compensation module (TCM) which adjusts the reported GPS position to account for the roll and pitch of the tractor. Since the receiver is usually mounted on the roof of a machine, anytime a while rides over a bump it causes the GPS receiver to pitch and roll, which if uncompensated for, would cause the tractor to veer to the right or the left. The TCM requires some setup and calibration so it knows how far above the ground it is, and how far from the pivoting axle of the machine it is. Also it needs to know where dead level is. This is all done through the Greenstar monitor.

Occasionally the receiver will report a TCM failure error. As long as this error code exists, Autotrac will not allow itself to engage. Typically a receiver with a failed TCM is sent to John Deere or AgExpress to be repaired. I've wondered what this TCM is, exactly, and how is it replaced, but since the Starfire receivers are hermetically sealed units, no one wants to break open a perfectly-servicable receiver to find out what's inside and I can find no information online about the internals of these units.

Fortunately, or unfortunately, I had an opportunity to open one up and peer inside, and this post has pictures of what I found. It was very interesting and educational.

Failed TCM

A couple of years ago in preparation for the end of life of the Starfire iTC receiver which has served us well for many years, we bought a used Starfire 3000 online. The seller indicated he worked for a John Deere dealer and repaired receivers. This receiver that we purchased was one he had recently repaired to replace the TCM. Because of the work required, he had to cut open the receiver, do the repair, and then glue on a new dome. After we got the unit, for various reasons it sat on the shelf for about a year after which I decided I probably should just replace the iTC with it. Unfortunately the brown box monitor reported that there was a problem with the TCM and thus autosteer wouldn't work. I'd long since forgotten who the seller was, and for various reasons, put it back on the shelf until the demise of the iTC forced me to revisit the issue.

Since I knew the unit had had its TCM module replaced, I was curious why it was reporting failure. I'm sure shipping is hard on any package and since the heart of any TCM-type module is a set of MEMS gyros and accelerometers, I'm sure they can be break. They are little physical mechanisms that move after all. Since I knew the receiver had been worked on and had a replacement dome installed (a taller dome than the original dome), I wondered if I could soften the glue and remove the dome and have a look inside. I reasoned that the "TCM" had to be some kind of plug-in module, or at least easily replaced by technicians, so I wanted to have a look. Sure enough I was able to open it without damage and this post contains pictures of the internals and documents what I learned.

Opening a Starfire globe

Starfire globes are hermetically sealed, and the only way to open them if they've never been opened before is to cut the dome off. This unit had been cut just below the rim of the dome previously. The replacement dome was slightly taller and glued on. I've heard the AgExpress used to cut the yellow part of the dome, and then plastic welded it back together with acetone when they were done. Now AgExpress has a source of replacement yellow domes. Perhaps similar to the taller dome this unit now has.

Antenna

The first thing you see under the dome is the antenna.

The anntena can be removed by undoing the four screws that line up with the antenna leaves.

The TCM

Under the Antenna is the top of the aluminum chassis that encloses the main circuit board. This thing is build ruggedly, and the aluminum chassis sandwhiches the board for maximum RF shielding. Attached to the top of the chassis, and connected to the main board by a small ribbon cable, is the heart of the TCM, the gyro/accelerometer unit. In the Starfire 3000 I have, it is an Analog Devices ADIS16364BMLZ six-axis innertial sensor. It consists of three gyros and three accelerometers.

Technically the TCM is a program running on the receiver's CPU that takes innertial information from this sensor, and adjusts the GPS position to compensate for any roll and pitch of the machine. Roll is the most critical. However when the receiver reports that the TCM has failed, it's referring to this innertial sensor. When AgExpress or others replace the TCM, this is the module they replace. This module can be purchased from Digikey, Mouser, and from other component vendors. The data sheet can be found here.

Other Starfire models may have other sensors or different versions of this sensor. Eventually I'll crack open the old iTC and see what sensor it used.

The main board

Once the screws holding the chassis together are removed, we can see the main board. It is a very complicated board, entirely built from surface-mount components and chips attached with tiny ball grid solder arrays. To repair anything on this board requires fancy and expensive rework equipment and Louis Rossman-type skill. After seeing that, I knew that the "TCM replacement" was entirely that innertial sensor.

Oddly enough there were two bodge wires on my receiver. I assume they were done by the most recent repair. The little bodge wire was not soldered very well, but until it causes problems I won't try to re-solder it.

Final analysis and "repair."

After seeing what the TCM was, I was all set to order a new one from Digikey. However I got wondering if the problem wasn't something more simple, like the little ribbon connector not being properly seated, or being jarred in shipping and losing connection, even though the connector is held down by a little bracked with a piece of foam. I popped off the ribbon connector which came off very easily and put it back on. I put the whole thing back together again and tried it out and it worked just fine! Later on I decided to tear the receiver apart again to take pictures for this blog, since there just aren't any pictures out there. This time it was really difficult to get the connector unplugged. So that confirms that the problem all along was the connector. I double checked the pins and none were bent. After taking pictures I pushed it back on and put everything back togther.

All I need to do is re-glue the dome on. And I noticed that this receiver happens to be unlocked for SF2 and RTK if I ever want that. Bonus! But I have other plans for RTK.

Should you replace your own TCM?

If you're well past warranty and if you're not afraid of cutting the dome open and have a plan to re-seal it when you're done, I don't see any reason why you couldn't do it your self. Have a look first at the gyro/accelerometer unit inside the receiver to make sure you can get an exact replacement (different part numbers have different measurement characteristics).

However, given the cost of the replacement gyro unit, the price AgExpress charges to do the replacement and replace the yellow cover is quite modest.

Saturday, 9 May 2020

Fixing broken nozzle body saddle with 3D printing

Our sprayer uses Wilger Combo-Rate nozzle bodies which clamp around the boom pipe, with a line up tube that pushes into a 3/8" hole in the boom pipe. Pesticide solution flows through that hole, though the tube, and into the nozzle body, which sprays on the plants. Although the nozzle bodies are protected by the structure of the booms, occasionally they get bumped and the line up tube sheers off or breaks as the saddle is forcibly twisted around the boom pipe. Although these nozzle body saddles are not very expensive, it is annoying to throw out an other-wise intact nozzle body. This line up tube does not take pressure; the body is actually sealed to the boom pipe by the o-ring that is around the line up tube. The purpose of these protrusions is simply to keep the body lined up with the hole. So I got wondering if I could 3D print a little piece to replace this broken line-up tube.

Using FreeCAD, I designed this simple part. It's designed to fit into the nozzle body and be glued in place, or tightly fit with friction. Like the original bit that broke off, the o-ring fits around it, which makes the seal.

Here are the dimension I used, in mm. The larger end is intended to fit in the standard 3/8" hole in the boom pipes. The smaller end should fit in a 5/16" hole, drilled out in the nozzle body.

To install, the broken tabs of the original line up tube should be cut off flush with the bottom of the o-ring seat. Then, using a 5/16" drill bit, or a 21/64" drill bit if need be, drill out the hole. Then this printed piece can be glued into the hole, pushing the smaller diameter end in until the wider end sits as flush as possible with the bottom of the saddle. The o-ring can be replaced. The finished repair looks like this:

Other nozzle body types

Nozzle bodies from other manufacturers could also be repaired like this. In fact the dimensions I use here would work with any nozzle body saddle from any manufacturer that is designed to work with a 3/8" hole.

Materials

Ideally, ABS or ASA plastic should be used, as those are the most resistant to water and chemicals. However my prototype is just made out of PLA. It may get brittle and break, or swell up with water. PLA is not recommended, but I suspect it will work fine for quite a long time. I printed it at 0.2mm layer height. Infill does not matter since there won't be any infill with the thin walls. Regular super glue is likely good enough to hold the new piece in place. Even friction may be enough.

Thursday, 13 February 2020

Approximating a trailer's path

Several years ago, Brian Tischler developed his own solution for using GPS to record farm machinery coverage in a field and to automatically turn things on and off as the machine crossed into areas that it had already been in. This is known in the industry as "section control." Brian's program, AgOpenGPS, and the community that surrounds it, is incredibly useful, education, and affordable. Already quite a number of farmers throughout the world have build their own GPS solutions for their farm machines including using GPS to steer with, providing straight rows and saving money reducing overlap of costly applications of fertilizer, seed, or other chemicals.

Initially, AgOpenGPS acted as if the implement a farmers was pulling was fixed to the back of the tractor, which is often the case when using 3-point hitch equipment. However if a trailing implement was being pulled, AgOpenGPS would think it was straight back from the tractor, when it fact it was trailing and swinging shorter during turns. My first, and so far only, contribution to AgOpenGPS was an algorithm for approximating where the trailer is tracking

The algorithm

The algorithm I came up with is not based on any research or literature, and it's only an approximation of the real path. It does not take into account side drafting or slipping of the trailer. There are three things that factor into the computation. First, the new GPS position of the tractor. Second, the length of the tongue of the trailer, from where it attaches to the tractor to the center of yaw of the trailer, which is usually the axle. Third, the old computed position of the center of yaw point on the trailer, from the last iteration. In general terms, the algorithm is composed of three steps, repeated each time a new GPS position is known.

  1. Calculate the angle or bearing from the new GPS position to the position where the trailer was before.
  2. Along that bearing, find the location that is the distance equal to the length of the tongue away from the new GPS position.
  3. Assign the trailer position to be that position calculated in step 2.

The more often you measure position and perform these calculations, the calculated trailer position will more closely approximate the real trailer's path.

Whether we are dealing with longitude and latitude, and using Haversines methods and ellipsoidal or spherical means of calculating distances, bearings, and new positions after a given bearing and distance, or if we are dealing with rectangular grid coordinates and simple trigonometry, the effect is the same.

Rectangular coordinates

Here's a diagram showing the original state of a trailer and the result of the first iteration overlaid to illustrate how this works using rectangular coordinates, where e is for "easting" (x coordinate) and "n" is for "northing" (y coordinate):

In the diagram, the first blue cross represents the axle and tongue of the trailer. The green line represents where the GPS location reported for the tractor moved from V0 to V1. The new trailer position can be calculated using trigonometry for rectangular coordinates. But since we're really dealing with similar triangles here, it can also be calculated by using nothing other than the Pythagorean Theorem and applying a ratio, as can be seen in the diagram.

Using latitude and longitude (spherical coordinates)

Using latitude, longitude, the haversine formula, and another position algorithm, it looks like this in C++:

void move_distance_bearing( double &lat, double &lon,
                          double heading, double distance)
{
 double offset = distance / EARTH_RADIUS; 
 double latr = RADIANS(lat);
 double lonr = RADIANS(lon);

 double lat1sin = sin(latr); 

 double lat1cos = cos(latr);
 double distcos = cos(offset);
 double distsin = sin(offset);

 heading = RADIANS(heading);

 lat = asin( lat1sin * distcos +
             lat1cos * distsin * cos(heading) );
 lon = lonr + atan2( sin(heading) * distsin * lat1cos,
                    distcos - lat1sin * sin(lat) );

 lat = DEGREES(lat);
 lon = DEGREES(lon);
}

void trailer_move(double lat, double lon, 
                  double &trailer_lat, double &trailer_lon, 
    double heading, double hitch_length)
{
 //step 1. Calculate bearing from new GPS position to
 //        last trailer position
 if (trailer_lat >= -90) {
  //if last trailer position was known
  heading = haversine_bearing_degrees(
   lon, lat, trailer_lon, trailer_lat );
 } else {
  //otherwise just translate backwards along
  //the current GPS heading (assume trailer is
  //straight behind).
  heading = heading + 180;
 }

 //step 2. Find location that along that bearing that is 
 //        hitch_length from the current GPS position.
 move_distance_bearing (lat, lon, heading, hitch_length);

 //step 3. That location becomes the new trailer position
 trailer_lat = lat;
 trailer_lon = lon;
}

The function, haversine_bearing_degrees() is not given here, but it's an implementation of the standard haversine formula. Also not known are macros DEGREES(), RADIANS(), and the EARTH_RADIUS defines, which anyone can implement. The radius should be in whatever units you use for the other distance and hitch_length variables.

The Haversine and the new position formulas above are based on a spherical approximation of the Earth, which has inaccuracies. An ellipsoidal method would be more accurate. However, compared to working in UTM coordinates which use an ellipsoidal model, at my elevation the differences are often within a cm or two, which is enough for our purposes, especially given that this is just an approximation anyway.

Only an approximation

As said before, this algorithm is only an approximation. As you can see from the diagram above, the calculated path the trailer makes will not be a smooth, continuous arc. Rather it will be a bunch of little straight lines that track to the inside of the real path somewhat. The more often you iterate the calculation, provided you had very fine GPS position updates, the closer it would be come to the actual arc. In real farming experience, it's close enough to work for coverage mapping and section control, even with spraying.

Links

DIY RTK Part 2 - ZED-F9P Base Station

The ZED-F9P is a low-cost GPS receiver capable of everything you need to get sub-inch GPS RTK fixes, useful for everything from surveying to steering farm machines. Regardless of GPS receiver brand, RTK requires at least two GPS receivers. One is a base station that continuously makes observations of various signal characteristics, which are transmitted to the other GPS receiver, often called the rover. Since the base station is, by definition, not moving, the rover can use these observations to correct for various sources of error and refine its own position down to within about an inch. It's very remarkable and the ZED-F9P can resolve to an RTK fix in just a couple of seconds.

RTCMv3

As mentioned in the previous part, there is a standardized format for sharing these observations with roving GPS receivers, RTCMv3. RTCMv3 defines various message types, associated with the different GNSS constellations including GPS, Glonass, Galileo, Beidou, and others. Using all these constellations together makes the system more robust. Modern RTCMv3 message types encapsulate a wide variety of observations and information into the packets. The ZED-F9P supports the most recent types, called "Multiple Signal Messages," type 7. Fortunately the Trimble 372 also accepts these MSM7 messages.

Message Types Required

The message types that we use with the ZED-F9P are

  • 1077 - GPS
  • 1087 - Glonass (only actually useful for ZED-F9P rovers as far as I can tell
  • 1097 - Galileo
  • 1127 - Beidou

Those messages should be transmitted at a rate of at least 1/second.

Other message types we'll use include:

  • 1005 - Stationary RTK Reference Station ARP
  • 1008 - Base station antenna descriptor (not provided by ZED-F9P)
  • 1230 - Glonass base station bias characteristics (probably unused by F9P

Those messages can be transmitted every 10 seconds or more.

The ZED-F9P can generate all of these messages and transmit it out any of its onboard serial ports, which can be connected to radio modem, or using software on a single-board computer or microcontroller with wifi, to an NTRIP Caster.

Injecting type 1008 for Trimble 372

The Trimble 372 will establish an RTK fix if it can receive the following RTCMv3 messages:

  • 1005 (or 1006)
  • 1008
  • 1077
  • 1087
  • 1230

The 1008 message is not generated by the F9P, however the 372 doesn't actually need any of the information contained in that message, so even a blank message will do. I wrote a little program for an Arduino Uno that reads RTCMv3 messages in one serial port, adds the 1008 message, and transmits the combined results out the other serial port. Thus if a radio or NTRIP server takes the output from the Arduino, the 372 will get an RTK fix.

The code is posted at GitHub.

#include 

/*
  Reads in a stream of RTCM3 data on the software serial
  port, outputs it to the built-in serial port.  If
  a message type of 1005 or 1006 is detected, a blank
  1008 message will be inserted into the output stream,
  which should allow a ZED-F9P RTK base station to work with
  Trimble roving receivers, which require 1008.

  Pin 8 is RX from the radio module (unused)
  Pin 9 is TX to the radio module

  Pin 0 is RX from the F9P
  Pin 1 is TX to the F9P (unused)

  For Uno or similar board. Other boards might require
  different pins for the AltSoftSerial port.  See the
  AltSoftSerial documentation for more information.
 */

// Blank RTCM3 type 1008 message
const char packet1008[12] = { 0xd3,0x00,0x06,0x3f,0x00,0x00,0x00,0x00,0x00,0x99,0x25,0xca };

AltSoftSerial mySerial(10,9); // RX, TX

void setup() {
 Serial.begin(57600);
 while (!Serial) {
 ; // wait for serial port to connect. Needed for native USB port only
 }

 // set the data rate for the SoftwareSerial port
 mySerial.begin(57600);
}

void loop() {
 byte c;
 int length;
 unsigned int type;

 int count;
 c = 0;

 //Look for start of RTCM3 message
 while (c != 0xd3) {
  if (Serial.available()) {
   c = Serial.read();
   mySerial.write(c); //pass it through to the radio
  }
 }
  
 //Okay we might have found one, lets get the length
 count = 0;
 length = 0;
 while (count < 2) {
  if (Serial.available()) {
   c = Serial.read();
   mySerial.write(c);
   length = (length << 8) + c;
   count ++;
  }
 }
 length = length & 0x07ff; //isolate only the least significant 10 bits
 
 //identify the message type
 count = 0;
 type = 0;
 while (count < 2) {
  if (Serial.available()) {
   c = Serial.read();
   mySerial.write(c);
   type = (type << 8) + c;
   count ++;
  }
 }
 type = type >> 4; //isolate type form the most significant 12 bits

 //Now pass through the rest of the message
 count = 0;
 while (count < length + 1) {
  //read in the message body, less the 2 type bytes, and then
  //the 3 CRC bytes, so length + 1.
  if (Serial.available()) {
   c = Serial.read();
   mySerial.write(c);
   count ++;
  }
 }

 if (type == 1005 || type == 1006) {
  //inject a 1008 message
  mySerial.write(packet1008, 12);
 }
}

Hardware

The base station itself, at present, consists of several components including:

  • 12V to 5V power supply (in future replace with 110v to 5v)
  • ZED-F9P on a SparkFun RTK2 board
  • Arduino Uno
  • Digi 9xTend frequency hopping 1 watt transmitter, using xTend firmware, not mesh

Connecting it together

The ZED-F9P is configured to act as a base station (including either a set latitude and longitude or averaging position using Survey-in), and to output the RTCMv3 messages we desire on UART2.

5v Power is supplied to the 5v rail of all the components. The F9P UART2 wires are connected to the primary serial input of the Arduino, pins 0 and 1. The software serial output pins on the Uno are connected to the Digi 9Xtend radio module.

I used some protoyping shields to make it easier to connect everything in a way that would allow me to easily disconnect parts. The Digi radio is attached to a 20-pin 2mm pitch socket on the first proto board. The power wires and UART connection from the F9P are done on a second prototype shield stacked on top. Originally I used an Ardusimple RTK2 shield instead of the Sparkfun board, which attached on top of that, making a neat stack. When I damaged the Ardusimple board I chose to mount a Sparkfun RTK2 board on a 3d-printed stand next to the original stack. This made a pretty nice clean setup inside the enclosure.

Future plans

In the future I may change the Arduino Uno board out for an ESP32 microcontroller board. This would let me inject the 1008 message, feed the radio, and also send the RTCMv3 feed out the internet via WiFi to an NTRIP Caster.

Links