A small desk toy that makes cutesy faces when someone is in front of it. It also publishes occupancy status via MQTT for integration into Home Assistant.
- Waveshare ESP32C6 1.47 LCD - Non-touchscreen version. The touchscreen version uses a different display driver that is mostly compatible with the ST7789 driver, but different enough that I couldn't get it to work right. The colors were grayscale and I couldn't figure out register settings that worked. The datasheet for the touchscreen version's driver appears incomplete.
- LD2410C mmWave sensor - Only utilizing the digital pin for occupancy sensing. Serial is not implemented.
- AM312 PIR sensor
I used a USB-C pigtail from Amazon to power everything. The AM312 is wired to the 3v rail but the LD2410C is wired to the 5v rail because it has an on-board regulator.
There are two config files: config.h and net_config.h.
- config.h has the pin assignments for the sensors, the screen colors, and the backlight on/off settings. As well as some other settings that you can play with.
- net_config.h is where you will put you wifi info, MQTT broker info, and where you can adjust the topics.
The code uses LVGL timers, so you will need the LVGL library installed in Arduino for this to compile and run.
Part of the reason I made this project was because I wanted to try out using AI to code a simple project of the type I typically make. It was an interesting exercise and a good learning experience, but some things aren't quite right. For example, there is code in the mqtt_mgr.h to publish Home Assitant discovery messages, but they don't work, and I have not investigated why. It's easy to set up as a binary sensor. All of the code was written by CoPilot, with the exception of the ST7789 driver and the PubSubClient library. The ST7789 driver is straight from the LCD screen example code, and PubSubClient is an open source repo available here on Github. Additionally, the images were made in GIMP and converted to C arrays using an online tool available at https://notisrac.github.io/FileToCArray/
Code behavior is explaned in the DeskBot_v2_software_spec.md document. That was the source doc I gave to Copilot for development.