so i am trying to bring in some torque measurement into the arduino code and got a little bit stuck. But first things first:
Using 4.3.1 UDP, MD13s, Phidgets and dual antenna.
Wired in a 1-Channel Relay for cutting off Phidgets completely via PWM2.
Works fine till here.
Got inspired by some topics the other day to do some “torque disengagement”.
Especially the things brought up by @Bennet and @Juliennorth
So brought in a current sensor ACS712 which is wired to the ADS1115 on A2.
ADS returns some nicer readings of the ACS712 output values imo.
Also installed a poti which is wired to A3 of the Nano.
The idea is to bring certain levels of allowed amperage at certain pwm outputs.
Fine tuning it by allowing a little bit “extra” amperage defined via poti.
So imo the code would be best placed in the autosteer nano with having the pwm values at hand.
When testing the code, it works.
But the big disadvantage is reaction time is way longer than on the original code.
Best example: Manual auto steering and setting it 0°, to 5°, 0° etc. etc.
(feels like 0.5 sec doing nothing, then does the steering)
Loading in original code, everything is fine. Except torque disengagement…
I know i am doing something wrong here, but where ?
Question is: did i exceed the cycle time at some point ?
Does the arduino have some hp left for some more code?
I did use an array with 10 elements of doubles to average out the amperage.
That might help to slow it down…
Trying to optimize it. Maybe someone had similar problems.
Thanks @Apm !
Tested the code today and it was even worse.
So that got me thinking.
Your code is sampling the adc 5 times every cycle to eliminate the array. Cool idea.
My version did it once every cycle. So made a comment out of it and it was back to good old speed.
Then i noticed a “delay(10)” at the end of the main loop in the Autosteer_UDP ino.
Thought: “hmm…”, commented it out, put my code back in and it runs at lightning speed… (bit overestimated… but hey. )
So i am wondering if i did something deeply wrong here ?! Dunno. But runs.
Maybe someone can explain what the delay is meant to do.
Hello, i would like to use your code in my tractor for disengaging the motor from the steereing wheel. I am using a servo to move the phidget.
I am having trouble with the readings from the amperometer, they are out of scale like always 23 amps even with nothing connected. I have tried the sensor with a test sketch and it is working as it should.
I have connected the sensor to aux1 on pcb v2, is it correct?
could you explain more your setup?
Thank you, but I did not manage to have usable readings from aux1(A2) adc. Dont know why, always in between 22 or 23 amps when nothing is connected. So I am using directly the nano for readings, I have connected asc712 to A0 and change a little bit the code, works pretty good.
Could you make a video of your setup working?
This is mine AgOpenGps Case JXU 115 auto disengage motor - YouTube
Can do, when i have some free time.
But looks functionwise at lot like yours.
Looks cool with the automatic engagement!
It takes a second to notice the rise in amperage.
But thats fine for me.
Fine tuning when finding some time.
Maybe adding some “tune-mode”, recording amperage for different speeds, steering from full left to right and back? Dunno. Thats whats hovering in my mind.
Should add some sensitivity.
Just an idea, and probably not able to program it myself, but: would it be possible to use the “Count number” for the encoder turn of from AOG and use it to multiply/divide the output from ADS1115, and that way get possibility to adjust ampere turn off setpoint, directly from AOG?
I think i dont fully understand what you are thinking about.
System doesnt use an encoder at the motor, just using the encoder count to shut off autosteer when steering-amperage is over allowed setpoint.
But thinking about it… (and maybe thats what you meant :))
Why not use a simple encoder at the motor to generate a following error.
Would be immediate response. But also more knickknack to go wrong.
So… not sure about it. Fine tuning ACS seems to be simplest solution.
What I mean is, if you want to hit 3372, I want to use the number you can set in AOG, let’s say 6 and then have the number 562 in the program. If you want the program to cut off at higher ampere set 8 in AOG and program shut off at 4496
Hi! thank you first for sharing your ideas. I have followed the discussion with interest because it coincides with my idea to disconnect the steer (ACS712, steer arduino. ButI like the option of regulating it through a poti). Your idea of reading with ADS sounds great to me. My problem is ignorance of the code. So, if you would be so kind, upload a downloadable .ino file.
I´ve tried but can’t find a place to put your code and make it work.
Hi Lui, I need your help again, I can’t disengage auto steer:
My communication is via USB. I´ve copied your modifications to my Autosteer_USB_cmps14.ino but it didn’t get it to work.
The readings from my ACS 712 20A (connected to A2 of the ADC and conected on the power line (+) of the Cytron) range from 2.32, without load, to 2.45V, stopped the motor. Those of the Poti from 0 to 10V (to the A1 of the Arduino). Without disengagemnt at any case.
My notions of C ++ are very basic; I don’t understand how the disengagement occurs: directly from D6, auxiliary relay parallel to the steer switch?
Where can my mistake be?