The purpose of this post is to share the code that I have designed and implemented for the charging system for mobile robots with ROS. First, I will share the code needed to program the Arduino installed in the charging base. This board is the Arduino UNO model and it controls the signals emited by the three IR leds. I studied the most common protocols for IR signals, as NEC and SIRC, but finally I designed my own codification for the signals. In the next image, you can see the signals of each led, that would be emitted at same time:
The sum of the 3 signals that a sensor would get if it receives the signal of the 3 IR leds is showed in the next image:
As the signals are Infrarred, the high pulses are modulated at 38 kHz. In the next image of the osciloscope, it is shown the modulation of the signal of one of the emitters, and below it, it is shown the output of the IR receiver which shows that it is receiving the start pulse and 2 more pulses (the direct output is the inverse of the real signal):
The full code with explanations is available in GitHub. If you have any doubt about how it works, write us!