Why did you set the pwm frequency to 20833 at the 2040 zumo robot? Is there a important reason to it?
And one more question. Can I set the proxymity sensors to a level that they could avoid walls? I changed the levels, but that was not really a solution. But ok, the sensors are more to detect and attack
Frequencies 20 kHz and higher are outside of human audible range, so setting the PWM frequency above that level makes the system quieter. Beyond that, the specific frequency has to do with the system clock (125 MHz), and the range of values we set up the speed variable to use (0 to 6000).
125 \text{ MHz} / 6000 = 20833 \text{ Hz}
I do not understand your question about the proximity sensors. The levels you mentioned just refers to the brightness of the IR LED emitters. How well the proximity sensors work will depend on several details of the specific application (ambient lighting conditions, target reflectivity, etc.) but I generally expect the Zumo proximity sensors to be able to detect walls (at least at some range), and by checking the proximity sensors readings with the LEDs set to different brightness levels, you might be able to estimate their distance. If that does not address your concerns about the proximity sensors, could you try rephrasing your question and adding more details about what you are trying to do?
Thank you very much for the explenation. This helps a lot. Now I understand more :).
Ok, sorry, my english is not the best. The proxymity sensors work perfect, the whole robot works absolut great. I only want to know if it is possible to sense the distance shorter. So the sensors find the walls in 30 cm. Ich reduced the brightness levels and then they detect the wall in maybe 25 cm. But I did not find a way to detect something at 10 cm. So I search for a way that I can get closer to the wall and then avoid it. Not at 30 cm. I think I have to understand more about the brightness process and the sensors.
You helped me a lot.
You could try looking into adding to or modifying the proximity sensor related parts of our library to make the IR LEDs operate at lower brightness levels than the defaults we set up.
Alternatively, if your primary concern is a wall directly in front of your Zumo, and it consistently detects walls around 30 cm away, then one approach for moving closer to the wall might be start monitoring the Zumo’s built-in motor encoders the moment you detect the wall. Then, you can turn off the motors once the encoder feedback indicates that you have moved around 20 cm closer.
Ah, very good idea with the encoders. I think this will be a good way. Thank you very much. Now you really engaged my brain. Awesome.
Lowering the brightness levels work, but not good enough. The sensors are too good :).
It will be an interesting thing to combine detecting and encoders. Thank you for this idea. A new step in programming the zumo.