A simple and engaging embedded project using an STM32F100C8 microcontroller, an LDR, and a 0.96" SSD1306 OLED. The OLED displays different fox images depending on ambient light intensity:
- Bright environment → Happy fox
- Dark environment → Scared fox
All source code, images, and project files are included in this repository.
- Reads ambient light using the STM32 internal ADC
- Displays custom images on an SSD1306 OLED via I2C
- Light-based image switching (happy/scared fox)
- Custom images stored as C-arrays
- Uses a clean pre-written SSD1306 driver
- Beginner-friendly and fully documented
- STM32F100C8 (or STM32F103 compatible)
- SSD1306 OLED display (I2C)
- LDR + 10k resistor (voltage divider)
- Breadboard and jumper wires
- The LDR and 10k resistor create a voltage divider.
- The ADC reads this voltage to determine light intensity.
- A simple threshold decides whether it is “light” or “dark.”
- Depending on the light level, the OLED displays either:
- happy fox
- scared fox
- Images are converted to monochrome C-arrays using online tools.
- Open the project in STM32CubeIDE (or any STM32 toolchain).
- Build and flash the firmware to your board.
- Change the light around the LDR and observe the OLED reaction.
A full demonstration video is available on the Sly Fox Electronics YouTube channel.
- This project is under the MIT License.
- You may modify and reuse the code freely.
- Feel free to open issues or submit pull requests.
- If you find the project useful, consider starring the repo.
