Skip to content
Andreas Ortner edited this page Oct 1, 2019 · 24 revisions

Welcome to the AgOpenGPS wiki!

====== AgOpenGPS Dokuwiki ======

AgOpenGPS

*** Important ***

This software is for discussion and learning of Precision Ag algorithms and techniques. It is not in any way to be used on any physical equipment and is meant for use by a simulator only.

Any use of AgOpenGPS on real physical equipment is not allowed and is not recommended in any way, neither off road or on road.

It is completely unsafe and has no safety limits built in or implied.

AgOpenGPS is strictly an example of C# programming for demonstration purposes only and shall not be used for any other purpose.

Ag Precision Mapping and Section Control Software

This software reads NMEA strings for the purpose of recording and mapping position information for Agricultural use. Also it has up to 8 Section Control to control implements application of product preventing over-application.

Also outputs angle delta and distance from reference line for AB line and Contour guidance.

Included is an application, and source folders, along with UDP, TCP/IP, and serial NMEA simulators.

====== Step by Step Software & Hardware Setup ====== This Wiki is about to undergo some major updates please bear with some errors and oversights in the meantime. Follow these steps below.

5 components are required for a vehicle that uses AgOpenGPS for autosteer

=====Laptop/Tablet===== AgOpenGPS runs on the Windows operating system. It uses the .NET framework (4.0 minimum).

The minimum screen resolution AgOpenGPS will work with is 1024 x 768.

1920 x 1080 is preferred, and of course the higher resolutions found on the Acer transformer 300, Acer Switch 12, Microsoft Surface, or Samsung work even better.

A Touchscreen is preferred to work with AgOpenGPS.

When selecting a tablet, ensure it has at least one USB port free with its charging cord plugged in. You need to charge the tablet and use a USB port for external hardware (arduino) at the same time. Another thing to consider is screen brightness, 1000 NITS is ideal. Agopengps will also use Ethernet in future so keep this in mind if you upgrading.

Download software from https://github.com/farmerbriantee/AgOpenGPS There are some repos:

agopengps: is an old stable version

  • Click AgOpenGPS:
  • Click green button: Clone or download / Download zip
  • unzip

Folder Contains:

  • AgOpenGPS: the software
    • Application: AgOpenGPS -this is the software icon → {{{ :aog_app_snip.jpg?400|}}
    • Source: -this is the source code
    • Modules: -This contains the Arduino codes ===== GPS and visual guidiance =====

To start you can use any GPS receiver which can output NMEA data over a usb (serial) port. For further information see the upgrading section.

Now you can go through the menus and setup the software. For simple use with fertilizer and sprayer you are ready to go.

===== Section Control =====

https://www.youtube.com/watch?v=QM06A332rwU

You need an arduino uno/nano and

https://www.amazon.de/dp/B01C2IN2U2/ref=asc_df_B01C2IN2U256101088/?tag=googshopde-21&creative=22434&creativeASIN=B01C2IN2U2&linkCode=df0&hvadid=232019949970&hvpos=1o1&hvnetw=g&hvrand=2396920004769529166&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=20047&hvtargid=pla-422799561783&th=1&psc=1

First goto https://www.arduino.cc/ and download Arduino IDE.

You need it for the USB drivers and for setup of your arduino.

You find different version to use the section controll sketch.

you can use any of the autosteer (or etherneth version)

Go to your agopengps folder /Autosteer and open autosteer.ino

open relays.ino and uncomment as much lines you need for sections

void SetRelays(void) { //use either "relay" for sections, or "uTurn" for uTurn signals and relays if (bitRead(relay,0)) bitSet(PORTD, 5); //Digital Pin 5 else bitClear(PORTD, 5); //if (bitRead(relay,1)) bitSet(PORTD, 6); //Digital Pin 6 //else bitClear(PORTD, 6); //if (bitRead(relay,2)) bitSet(PORTD, 7); //Digital Pin 7 //else bitClear(PORTD, 7); //if (bitRead(relay,3)) bitSet(PORTB, 0); //Digital Pin 8 //else bitClear(PORTB, 0); //if (bitRead(relay,4)) bitSet(PORTB, 1); //Digital Pin 9 //else bitClear(PORTB, 1); //if (bitRead(relay,5)) bitSet(PORTB, 2); //Digital Pin 10 //else bitClear(PORTB, 2); //if (bitRead(relay,6)) bitSet(PORTC, 4); //analog Pin A4 //else bitClear(PORTC, 4); //if (bitRead(relay,7)) bitSet(PORTC, 5); //Analog Pin A5 //else bitClear(PORTC, 5); }

In this code you see always were you need to connect your relay board ( pin 6-10 and a4,a5)

===== Autosteer =====

If you want a basic autosteer system refer to this schematic{{autosteer_switch_minimum_config.jpg?75}}

Minimum parts required\ 12V to 5V converter\ IBT2 motor driver(BTS7960)\ Wheel angle sensor(Delphi ER10031)http://agopengps.gh-ortner.com/doku.php?id=steering_angle_sensor:start\ Microswitch or momentary button\ Arduino Nano\ Steer Motor (refer to http://agopengps.gh-ortner.com/doku.php?id=steering_motor:start)\ If you do not want a steering motor in the cab and more interested in hydraulic steeringhttp://agopengps.gh-ortner.com/doku.php?id=hydraulic_steering:start )\ Ribbon wire with various ends(m/m, m/f, f/f)\ Breadboards\ Various electrical connectors and wire\ Soldering components\ Optional parts\ Arduino Nano Shield\ 12 to 24 volt converter(if using a 24V steer motor)\ 12V multiple usb hub(to power other equipment)

If you want an autosteer system that can compensate for roll on hills and/or fuse heading with the GPS signal refer to this schematic{{autosteer_switch_full_20config.jpg?75}}

Parts required\ All parts required in minimum config plus...\ BNO 055 IMU\ MMA 8452 Inclinometer\ Optional Part\ ADS 1115 Analog-Digital Converter http://agopengps.gh-ortner.com/doku.php?id=steering_angle_sensor:start

  • The BNO055 IMU has been found to only work reliably when placed as far from metal as possible. Usually it is placed on the roof in a weatherproof container or very high on the windshield. Keep this in mind when building your board.\
  • There is a 5v version and a 3.3 v version of the MMA 8452/1. If using the 3.3v version you can power it from the 3.3v supply pin of arduino and in series add 330 ohm resistors to SCL and SDA lines.\
  • If you do not use the ADS analog to digital converter connect the sense wire from the wheel sensor to A0 on the Nano.

Afer building your board go to https://www.arduino.cc/ and download Arduino IDE.

You need it for the USB drivers and for the setup of your arduino.

Go to your agopengps folder / Modules and open either autosteer_switch or autosteer_button. Open the folder with same name and open autosteer(switch or button).ino file\ Use switch if you plan on installing a microswitch when motor engages the steering wheel.\ Use button if you plan to install a momentary button installed elsewhere\ Once it opens in IDE there will be a setup zone. These options will have to be changed to configure with your setup. To change these settings replace the number beside the statement with the number that corresponds to your setup {{how_to_prepare_the_sketch_for_upload_switch_.pdf|Preparing Arduino Code}}\ Leave the SteerPosZero at its setting for now. Connect your Arduino to the computer. Open tools and ensure the correct Arduino board is chosen. Choose the correct port(if having trouble google how to connect Arduino through com port) If using a knockoff Arduino it may require changing the processor. Go to tools/processor and choose atmega328 old bootloader. Try uploading the code.\

Tutorial on https://www.arduino.cc/en/Guide/ArduinoUno or https://www.youtube.com/watch?time_continue=11&v=d8_xXNcGYgo


If the code uploads and everything else is setup then open agopengps and try connecting the Arduino to the program.\ Be sure agopengps is open first before connecting the Arduino.\ Click on the gear button in the bottom right corner {{gear_button.jpg?200}}\ Open ports, choose the correct port for autosteer and hit connect. Once connected, click on the gear icon and open GPS IMU. Open the gps imu tab.\ Make sure you are on perfectly flat ground and hit the center button under the Roll/Pitch Zero\ If it has not been done already open the gear icon and setup your vehicle in the vehicle tab\ Now open the gear icon and select autosteer tab\ Click on drive tab{{drive_config.jpg?150}}\
Ensure wheels are pointed straight ahead and click on steer wizard\ Look at raw data from wheel sensor.{{steer_wizard.jpg?150}}\ If it is not 0 go back and click on steer config.{{steer_config.jpg?150}}\ Adjust the wheel sensor steer angle sensor zero up or down to get to zero. If you cannot obtain zero then open the Arduino code and adjust the steerposzero up or down and reupload. Close and open agopengps and try again.\ Once the sensor reads zero, close the wizard and click on the red drive button. The button will now turn green and the steer motor should respond to changes when the slider moves. Move the slider side to side and ensure the vehicle corresponds to the input correctly. If not you may have to invert angle sensor in Arduino code, reupload, close and open agopengps and try again.{{roll.png?250}}\ Once the vehicle corresponds correctly open the steer wizard and follow the instructions.\ After you obtain the counts per degree close the wizard and open the steer tab. Enter the counts per degree. Max steer angle is the maximum angle you want the vehicle to turn. Minimum pwm is the power that will be required before it is sent to the steer motor.(prevents the motor noise from PWM) At this point other settings will be variable and must be adjusted by trial and error. Here are PID settings with various motor and motor driver combinations. FarmerBrianTee has many youtube videos explaining theory on each setting. https://www.youtube.com/watch?v=rYBWaVwWf


Stable Power Supply: DC-DC buck converter that can output 5V might also want a second converter for a stable 12V source for powering USB hubs and inclinometer.

Steering Angle Sensor (Ride Height): Delphi ER10031

or for Canadians a cheaper ($5.99) version from Princess Auto Automotive Headlight Cover Lifter Sensorhttps://www.princessauto.com/en/detail/automotive-headlight-cover-lifter-sensor/A-p8735755e

Motor Controller: Cytron Technologies MD30C or IBT_2 43A Motor Driver also known as BTS7960B

====== Upgrading Agopengps ====== Follow these pages for further information

Gps:

Hydraulic Steering:

Section Controll:

Steering Angle Sensor:

roll:

Heading:

Steering Motor:

Ethernet:

====== Software Setup ======

Arduino:

AgopenGPS:

====== How AgOpenGPS works ======

  1. GPS sends position and heading info to AOG.

  2. Either Arduino with BNO055 or Brick via usb, sends heading to AOG.

  3. AOG then fuses the heading with the heading calculated from the current fix position and one a couple meters back and the heading of the BNO or Brick.

  4. The AB line is a point and a heading - but think of it as a line with 2 points. you take the pivot point of vehicle and measure the distance from it to the nearest point of the AB Line. You also need a point forward on the line, called the look ahead point or goal point that you intend to drive towards. Then you draw a circle using the heading of the vehicle, and the goal point where the radius is twice the distance on the other side of the ABLine twice the distance the vehicle is away. The circle is tangent to the pivot point. Using the wheelbase of the vehicle you can then calculate the required steering angle to follow that circle to your goal point.

  5. That steering angle is sent to the arduino, and the distance away from the AB Line (although the calculations are already done, it isn't really needed but rather is used to turn steering control off and on.

  6. The arduino sends the roll side to side ( the DOGS2 or MMA8450) to AOG and then AOG changes the antenna position to match the movement of the antenna as it leans over.

  7. The another job the arduino does is to make sure the steering angle sensor value equals the steering setpoint set by AOG. The PID loop keeps moving the steering wheels to match that value sent.

  8. The majority of the calculations and smarts are in AOG. The modules, like the auto steer module, only have to control specific tasks - which makes them significantly easier to build.

  9. There is a lot more going on in AOG, like boundaries, UTurn, OpenGL, GUI, and all the machine control stuff for AgraBot.

====== Simulator Mode ======

If using the simulator make sure the antenna is right over the pivot point - set pivot to antenna distance to about 5 cm. Set the wheelbase to around 450 cm. The simulator will use the settings from the vehicle loaded, not its own, so best to save one specifically for the sim.

Start a new field to work with simulator - do not change the coordinates of the sim after starting a field.

Turn off the sim after you played with it and restart agopengps for real work with gps plugged in.

It may cause problems when connecting to a real gps later. ===== Button Functions ===== {{::agopengps_buttons.png?1000|}}

===== Keyboard Functions =====

Sim:

  • L - Rest

  • K - Speed up

  • J - Stop

  • H - slow down

  • B . turn left

  • M - turn right

  • N - Zero steering

Ag:

  • F - new Job
  • A - Autosteer
  • D - Section Auto On/off
  • A - Autosteer

===== First Test ====

Open agopgengps.exe, it is found in the application folder and has a little blue icon.

GPS simulator simulates NMEA GPS signals and will open automatically. You can tell by watching the GPS info box. The latitude will read 53.xxx and longitude will read -111.xxx and will say PPS fix. You can enter local simulator coordinates by going to the File menu at the top Left of the screen. This will require a restart of the program however.

If you want to connect a GPS receiver; config>ports will open the ports dialog box, from there you can select which com port your receiver is plugged into.

==== Creating Field Boundaries and Headlands ====

Boundary determines the outside edge of the field. If using Auto section control the sections will not work outside the field boundary. You shouldn't be driving outside the field boundary as there are often hedgerows and trees;-)

Headland is for controlling U-Turn functions. The headland can only be created after a field boundary is created.

Starting a Field Hit Start or File>Start Field then >Create New. Enter what you want to call the field. Then click start again then>Boundary.

Option A (driving) If you are driving around the outside of the field click >Outer then depending on if you are driving around the field clockwise or counterclockwise click the question mark/arrow button to change which side of tractor the boundary is being drawn (default is right side). Then click >Go. Then click >Record and drive around the outside edge of the field. When you've completed your lap around the field click >Done. Now your Boundary is complete.

Option B (Google Earth) If you want to create a boundary using Google Earth... Click> Google Earth and then once Google Earth opens click >add polygon or >add path. The pop-up window that appears has to stay open while you are drawing a polygon or path. Once you've outlined your field boundary, title it in the pop-up window and click >OK>File>Save>Save Place As. Save as KML file and not the default KMZ to your desired location. Then go back to AgOpenGPS and click >Load KML and voila your boundary is ready to go.

Creating a Headland (this feature is currently unavailable. For now adjust the headland in U-Turn settings) This can only be done after a boundary is created. And you must be in AB or AB Curve mode for this to work.

Click >Start>Headland then choose how many tool widths you want in your headland and what percentage you would like your headland to be. In this window you can also edit the headland manually. Click > check mark icon and you're all set.

====== Errors ====== If something went wrong (eg. incorrect settings) and AgOpenGPS won't start properly.

There is a setting file which is stored in

C:\Users\YourUserNameHere\AppData\Local\AgOpenGPS

Just delete the whole directory and start again.

====== Glossary ======

AOG: Quite simply Ag Open GPS, an open source computer program for field guidance, navigation, and mapping started by Farmer Brian Tee

Arduino: refers to an open-source electronics platform or board and the software used to program it. (Techopedia)

Auto Steer Switch: A switch that you install to cut off the power to the auto steering motor (cordless drill, phidgets motor, spool valves etc.) Generally installed on the steering motor mounting frame so that it activates when you move the steering motor away from the steering wheel. This switch does not control the Auto steer button/icon on the AgOpenGPS screen it only turns off the electrical current flowing to your steering motor.

BNO055: an IMU made by Adafruit

Brick: In these threads we're talking about a specific IMU made by TinkerForge

DOG2: An inclinometer made by TE connectivity

GitHub: A website where programmers can post their Open Source Code and collaborate with one another on certain projects.

IMU: Inertial Measurement Unit is an electronic device that measures and reports a body's specific force, angular rate, and sometimes the magnetic field surrounding the body, using a combination of accelerometers and gyroscopes, sometimes also magnetometers. IMUs are typically used to maneuver aircraft, including unmanned aerial vehicles (UAVs), among many others, and spacecraft, including satellites and landers. Recent developments allow for the production of IMU-enabled GPS devices. An IMU allows a GPS receiver to work when GPS-signals are unavailable, such as in tunnels, inside buildings, or when electronic interference is present.[1] A wireless IMU is known as a WIMU.[2][3][4][5] (Wikipedia)

Inclinometer: an instrument for measuring angles of slope (or tilt), elevation or depression of an object with respect to gravity. (Wikipedia)

L2: One of two frequencies sent out to a rover from an RTK enabled base station to correct positional inaccuracies in GPS location. L1 is the other frequency. L5 is another frequency to be released.

** Non Reaction:** With non-reaction steering units there is no corresponding movement of the steering wheel when the driver is not steering the vehicle.

OC: Open center steering units have open connection between pump and tank in the neutral position. In open center steering systems, pumps with fixed displacement are used.

Reaction Steering: With reaction steering units any external forces acting on the steered wheels result in a corresponding movement of the steering wheel when the driver is not steering the vehicle.

RTK: stands for Real Time Kinematics satellite navigation is a technique used to enhance the precision of position data derived from satellite-based positioning systems (global navigation satellite systems, GNSS) such as GPS, GLONASS, Galileo, and BeiDou. It uses measurements of the phase of the signal's carrier wave, rather than the information content of the signal, and relies on a single reference station or interpolated virtual station to provide real-time corrections, providing up to centimetre-level accuracy. With reference to GPS in particular, the system is commonly referred to as Carrier-Phase Enhancement, or CPGPS.[1] It has applications in land survey, hydrographic survey, and in consumer unmanned aerial vehicle navigation. (Wikipedia)

WAAS: Wide Area Augmentation System is a correction to the GPS signals implemented primarily in aviation. This is known internationally as an SBAS system.

WAS: Wheel Angle Sensor A wheel angle sensors job is to know the exact location of the steering wheels

Work Switch: Enables/disables "painting" on the AgOpenGPS coverage map. It is a physical switch that you can install (on a remote hydraulic lever that raises and lowers a tillage implement for example) in order to avoid pushing the the manual button on the touchscreen.

** XTE: ** Cross track error. The distance away from an AB line.

====== other Wikis ====== Pictures Gallery of some farmers' installations pictures:start