Arduino/ESP radar projects found on the Internet typically use a 180° servo and a Processing sketch for visualizion on a PC monitor. To make it challenging enough to build one myself, I had to come up with something different. These were the requirements for my radar:
- Use a quiet stepper motor for a continuous 360° view
- Animate a realistic radar screen on the device’s own TFT display
- Use a single ESP32
- Make everything run on a built-in battery
The physical construction promised to be the challenge here, because I would mainly reuse proven code from previous projects. In particular, it was uncertain whether digital signals from an ultrasonic distance sensor and an I2C magnetometer could be reliably transmitted through the 6-wire slip ring that I was going to use. But before I could even test this, there was a mysterious conflict between the CheapStepper and TFT_eSPI libraries, although they didn’t share any GPIO pins at all. I finally got it to work by swapping some pins, but still have no idea what caused the problem.
|Once the stepper motor started to spin the two sensors in the rotor, only the magnetometer’s I2C readings were received in good order by the ESP32 at the opposite side of the slip ring. Eventually, it turned out that not all of the ring’s slip traces performed equally well. Luckily, four of them proved capable of reliably transmitting digital signals during rotation, so after using the ‘bad’ ones for VCC and GND, everything worked as planned.
As usual, my ancient smartphone’s camera had a hard time filming the small TFT display. The close up photo below gives a slightly better impression of the radar visualization, for which I used the latest version of what is hopefully to become an Arduino/ESP32 library (my first!) for rotating transparent layers on small TFT displays.
As for the graphics, the current maximum rotation speed for a radar of this size is 15 rpm, but in this project it’s greatly reduced by the stepper/gearbox combination (salvaged from an old printer), with which it is synchronized.
As the display of this gadget is quite small, I made it broadcast its readings via ESP-NOW as well. By connecting a second ESP32 to my PC, I can have a Processing sketch deliver a high resolution version of the radar. Full circle, that is!