I have an ultrasound sensor rigged up, controlled by a nano. When the sensor “sees” a tree it sends a trigger to turn on the manual section control button in AOG. It would also turn this off when it doesn’t see the tree.
Here’s my sensor array. I had to use more than 1 sensor due to the narrow cone and because the tree shelters are round. The Arduino code works well.
I have an open port on my usb hub to plug the sensor into. I will only need the sensor hooked up one time during the recording since the on and off would be recorded also.
This is my first real attempt any C# programming other than following along on learning tutorials.
I have tried a bit of code that I put together from samples online and not surprising I get errors when I insert it where I think it should go. I’d like to learn not only how to get this to work but why. If anyone would like to give me some guidance?
Controls.Designer.CS — where the manual button is controlled
Add at top add;
//Section Manual and Auto line ### 510
private void btnManualOffOn_Click(object sender, EventArgs e)
//code added to pass data from Tree detection sensor array
SerialPort myport = new SerialPort();
myport.BaudRate = 34800;
myport.PortName = "com4";
string data = myport.ReadLine(); //arduino sends On or Off
if (data = On)
//end of added code
You could direct/discrete connect the “sensing”-nano to the machine/section control-nano simulating an external button input, and use this way to relay the information into agopengps. Like the driver/an external trigger is pressing the button. You can still override the input and have no need to manipulate agopengps.
I agree with that. It just becomes an exterior switch. Tool is always on, and the spray relay signal is interrupted by a relay on the second nano. You could feed this back in to AOG, if you wanted to see it on the screen. But it will work just the same.
Doen’t this do what you are asking? I believe, the autosteer reads this and imports it to control the manual tool. That manual tool on records during the record session. I’m not familiar with most of this, someone else would know more than myself. But it appears that AOG reads this and turns the work on or off.
I Don’t know what that is for. I’ll have a look in the code and see if I can figure it out. In the mean time I have the code done to bring it in the USB. At least I think I do, I don’t get any errors. I’ll have time in a day or so to try it out. I’ll report back either way.
I’ve been following your efforts on grade control - good work!!
I struggled to find the whole works of that button, but it appears to read a switch in the autosteer serial read. It did not look like it was still active in the arduino code, but may have originally read pin 7. Somewhere on this forum, I saw someone with a full switch board that controlled each section outside of AOG and AOG would respond to each switch. May be something to look for.
Thanks for the compliment on grade control. Been slowly learning C# since early last summer. Prior to that, my last programing was in Fortran in the last millinium. It still amazes me that the computer can process that much information that fast.
Just curious what type of trees are you spraying? We live in pecan country and Hurricane Michael got most of them in our area. The orange groves did much better.
Which version of AoG are you using? On my sprayer, I’m using an older version where my modified autosteer ino monitors 5 analog pressure sensors and when they read a pressure above a certain threshold it tells AoG to turn on that section which paints the screen for me. There’s a certain section control PGN that allows the Arduino to override AoG. I think this is what you want. Off hand, I don’t know the details of that PGN but I could look it up once there’s time.
connect arduino with the Machine Serial Port
MTZ8302 Remote Switch code
Serial.println(“127,249,0,0,0,0,0,0,0,2”);//Turn Off Auto Sections
Serial.println(“127,249,0,0,0,0,0,0,0,1”);//Turn On Auto Sections
or with the AutoSteer Serial Port(need to enable WorkSwitch in toolsettings)
Serial.println(“127,253,0,0,0,0,1,0,0,0”);//Turn Off Auto Sections
Serial.println(“127,253,0,0,0,0,0,0,0,0”);//Turn On Auto Sections
We.ve got 2 - 3 acre pieces that for years tried to figure out something to make money rather than just mowing for fun. The patches are in city limits so have to keep them mowed. 3 years ago I happened on an article on Chestnuts, the rest is history. We live in NC Iowa - about 60 miles N of where the Derecho? big wind went through mid August.
I’ve seen some of the threads about using external buttons or switches. I need to go back and revisit them!!
If you record your path ( use the Martian in the upper left corner) 0f AOG - everything you do is recorded, speed, relays, etc. Brian’s video
Thanks for the machine code. I’ve watched Brian’s videos on this many times. It’s only when I need to implement something of my own that I really begin to understand how it all works, so I will also make this switch work that way.