There are plenty of LED cube projects available all over the web. I’ve done some research to learn more about the logic of the hardware and software. However, I didn’t want to copy any of those projects; I wanted to create my own. First I wanted to use one of the PIC24 microcontrollers but I decided to go with an ATmega328 – found them very cheap on eBay. The target was to use the least amount of I/O pins with the maximum functionality I could possibly squeeze out of the microcontroller to leave free pins for later development.
The LED distance warning sensor includes a HC-SR04 ultrasonic module connected to a PIC16F630 microcontroller. This simple circuit flashes the diode when an object is within 1 metre with the relevant rate of its distance; the closer the faster.