Like Torriem I am curious about the type of sensor.
Could be a sensor counting teeth (like 200 teeth per rotation of wheel) so count number will easily vary some numbers.
Or a sensor counting magnets on wheel (perhaps only one magnet per rotation) Wheel could stop right before magnet/sensor without counting or start with one count and stop just after last count.
Both situations it must be enough to make an average of 5 measurements and use that number of impulses for all speeds. Distance and rotation should not vary with speed.
Or as I have seen on my Cameleon seeder. Sensor was faulty, did no longer count all the teeth passing it, so speed was varying in seeder box while driving same speed with tractor.(and it did not help adjusting distance to tooth ring).
@torriem & @Larsvest don’t understand……. As I said I’m using gps speed, converting that to pwm and driving a mosfet…that my fertiliser spreader thinks its getting impulse’s for wheel sensor!?
Edit 2: so this calibration is done with the fake sensor?
I think we both are referring to this part of your first post.
That is why I ask what kind of impulses you get from spreader speed sensor, as it might be counts and not pwm
Or turn question around: what is the name/ part id of sensor?
Edit: Suggestion: Set control box to measure impulses per 100 m, then turn wheel exactly 1 round. Read the impulses and then look at how many Things has passed the sensor (bolt heads, teeth, magnets or…?)
If you are lucky impulses and things passed is same number
If this happens you can do some math and convert gps speed to some Hz
Yes…esp32 ledc set to 50 duty and changing frequency according to speed.
But it’s not working as I’d hoped, as I have said…do 100m at 1km/h get x number of counts…do same 100m at 5km/h I’m getting totally different count 22% different!
Actually I did understand that. I was pointing out there are sometimes more expected than a simple pulse.
But, SK21 is correct. PWM is not what you want. PWM means you have a fixed signal frequency, and only the amount of time spent high vs low changes, but the time from the beginning of the low signal to the end of the high signal is always fixed. The wheel sensor is not going to be like that. Instead it’s going to changing the pulse frequency, not the duty cycle. This is called PPM.
But also note that it might not be a simple high/low pulse (which is what I was getting at in my other message). Some wheel sensors (like the ones on my sprayer) use PPM current (not voltage), which is a subtle distinction. Basically means the pulse isn’t a full low (or full high) but pulled to low or high with a certain resistance value. The “non” pulse signal would be a different, higher resistance value. This is done so that the controller can detect a missing or failed sensor, or a short.
Changing the frequency not the duty is how I was doing it. But reading up more on esp32 pwm, I’m surprised it let me try to alter frequency on the fly! Think that could be some of my problem.
Don’t know about the sensor, but probably of more use is what’s the iso standard signal for the 9pin tractor communication socket? Either wheel or radar!
Also talks in the spreader about possibly using fsd v form signal, is that the canbus signal?
I see, I thought ESP32 had NMEA from the GNSS receiver and then it would be easy to calculate distance between two NMEA position messages. AOG certainly does but lacking the complete picture I should not try to guess where this all is implemented.
I’m surprised it worked too. some kind of interrupt-driven pulsing code is probably your best bet. Skip the built-in PWM mechanism entirely. It’s just not designed for that kind of thing.
I don’t know what the radar signal looks like either! It does seem to be somewhat standardized between manufacturers. My StarFire receivers simulate the radar signal, I know that.
I have an old Hemisphere Cresent A100 GPS receiver. The manual describes the radar simulated pulse output as: The radar-simulated pulse output provides accurate ground speed. The Crescent A100 uses pin 12 for the speed out pin. Pin 12 will output a square wave with a 50% duty cycle. The frequency of the square wave varies directly with speed. 94 Hz represents a speed of 1 meter per second, or a 28.65 pulse per foot traveled.
Could try to capture an oscilloscope view but I’m not expecting any surprise.
I remembered I had a pigtail made up that I was using for canbus capturing. I added the radar pin to it and stuck my portable hantek oscilloscope on it. I don’t really know how to use the scope, but from what I could tell, low was 0.5v and high was 5v. The pulses were equal width on and off, and the frequency was close to what NorthernFarmer quoted from the manual. At 26 mph, it was about 1.5 kHz. 2 mph was about 90 Hz.