what i think is the real problem is the ino is far too complicated, the combinations of all the different possibilities is like Linux - most of the people who try to understand what is going on walk away from it. Caution: Gonna vent a little bit here oneveryone lol.
There are 3 different kinds of MMA devices ranging from 12bit to 14 bit med grade (the 8452). The original code is written for the 8451 12 bit code, if using the 8452 i have no idea what the effect of that is.
Here is the setup code for the 8 million possibilities of hardware combinations out there:
//##########################################################################################################
//### Setup Zone ###########################################################################################
//##########################################################################################################
#define GPS_Refresh 10 // Enter the Hz refresh rate, example 5 or 10 or 8 with ublox
// Best is leave it at 10
#define Motor_Valve_Driver_Board 1 // 1 = Steering Motor/valves + Cytron MD30C, MD13A Driver
// 2 = Steering Motor/valves + IBT 2 Driver
#define A2D_Convertor_Mode 1 // 0 = No ADS, connect Wheel Angle Sensor (WAS) to Arduino A0
// Really try to use the ADS, it is much much better.
// 1 = ADS1115 Single Input Mode - Connect Signal to A0
// These sensors are DIY installed ones.
// 2 = ADS1115 Differential Mode - Connect Sensor GND to A1, Signal to A0
// These sensors are factory installed and powered by tractor oem wiring.
#define SteerPosZero 512 //adjust linkage as much as possible to read 0 degrees when wheels staight ahead
// Set to 1660 if using the ADS
// Set to 512 if using the Arduino A0
#define WAS_Invert 0 // set to 1 to Change Direction of Wheel Angle Sensor, must be positive turning right
#define Motor_Direction_Invert 0 // 1 = reverse output direction (Valve & Motor) 0 = Normal
#define SwitchOrButton 1 // set to 0 to use steer switch as switch
// set to 1 to use steer switch as button
// Button/switch pulls pin low to activate
#define BNO_Installed 0 // set to 1 to enable BNO055 IMU, otherwise set to 0 for none
#define Inclinometer_Installed 0 // set to 0 for none
// set to 1 if DOGS2 Inclinometer is installed and connected to ADS pin A2
// set to 2 if MMA8452 installed GY-45 (1C)
// set to 3 if MMA8452 installed Sparkfun, Adafruit MMA8451 (1D)
// set to 4 if DOGS2 installed and connected to Arduino pin A1
// Depending on board orientation, choose the right Axis for MMA,
// arrow shaft on MMA points in same direction as axle
#define UseMMA_X_Axis 1 // Set to 0 to use X axis of MMA
// Set to 1 to use Y axis of MMA
#define Roll_Invert 0 // Roll to the right must be positive
// Set to 1 if roll to right shows negative, otherwise set to 0
#define Relay_Type 0 // set to 0 for No Relays
// set to 1 for Section Relays
// set to 2 for uTurn Relays
#define EtherNet 0 // 0 = Serial/USB communcation with AOG
// 1 = Ethernet comunication with AOG (using a ENC28J60 chip)
#define CS_Pin 10 // Arduino Nano = 10 depending how CS of Ethernet Controller ENC28J60 is Connected
#define MaxSpeed 20 // km/h above → steering off
#define MinSpeed 1 // km/h below → sterring off (minimum = 0.25)
//##########################################################################################################
//### End of Setup Zone ####################################################################################
//##########################################################################################################
There are 5 different combinations for roll alone. I would like to make the setup for the arduino originate in AOG where it is just pulldowns and checkboxes - but the current format to create the firmware is compiler logic based creation. You can’t “set options” since the options are used to compile and then uploaded. Far too easy for anyone setting up to mess up big time.
For 2 years I’ve watched the conversations of how it doesn’t work on combine forum, so i designed a pcb so everyone could build the same basic system, 1 basic usb autosteer board. I thought people would just build it since all the information was there, a simple ino was working for it, and it worked. But that did not work out that way, people wanted to do their own thing - which i totally understand - not use the pcb, use the bno inside the cab, use the arduino a/d (terrible), use many different combinations of parts. Way too complicated and the problems will happen. Found out only a few actually wanted to make the pcb, back to square one.
Reading this thread - it really shouldn’t be happening. Andreas has assembled pcb boards that work perfectly with existing ino. If you build the pcb on github with the right parts, load the ino, set all the options correctly, it works perfectly - with UDP or USB. Works with the DOGS2 or the MMA equally well - we have 15 degree slopes - it works.
Yes, the ino needs the encoder code added. Easy enough. But i really really think we need an “approved setup” with a known functioning parts list, ino that doesn’t have a million settings, etc. If you choose to build your own thing or don’t want to build it that way - is there any reason you kind of shouldn’t be on your own? And if you don’t want to build the pcb - just buy it from Andreas. It’s still 5000x cheaper then commercial - and it works. And perhaps i need to start another thread called “Deciding on a boilerplate setup”. We know what works and what doesn’t, stop writing code for setups that are barely functional and lets use that experience and save a ton or tonne of grief to provide a successful experience to build autosteer.
Try setting the Kalman filter values by adding zeros or taking away zeros from varProcess - i can’t remember which way does what, the comment is wrong maybe. Recompile, go for a drive. The MMA is well tested, works perfectly. Look carefully at the MMA code of coffeetrac, it is sensitive for either 12 or 14 bits.