Intro: FPGA LED Auto Dimmer
This guide will allow you to build a timed dimmer with just an FPGA and some time. The dimmer's timer will reset only if time settings are changed or if the reset button is pushed. More on this in the steps below. This instructables assumes you can setup Vivado on your own.
Step 1: Things to Keep in Mind
- FPGA ours was a Basys 3 board with Xilinx Artix-7™ FPGA (XC7A35T-ICPG236C) More info about this board here : Xilinx FPGA
- A micro USB cable - to connect the board to your computer
- A computer
- We used Vivado which is free to use. You can download the web client which will be a 50 mb file but then will download the rest of the software when installing. You can also download the "single file download" which is towards the bottom of the page.
Step 2: Hard Mode
If you would like to challenge yourself you can try this on your own with out the help of our block diagrams or state diagrams. In the next steps we have these laid out for you. We also provide our complete code for you if you can't figure it out completely.
Things to know:
- use three switches to control the amount of time delay for dimming
- have a reset button to reset the timer
- the rest is up to you and how you would like to design the circuit
Step 3: How It Works (Easy)
We have attached a state diagram and a block diagram to assist in explaining the functionality. If maybe you couldn't solve the last part on your own you can take a look at these diagrams to help you out. The next step will have all the code complete for you but this is just if you wanted a little challenge.
Step 4: Code
We used VHDL code and Vivado to create the self-dimming LED, and it can be reset and adjusted for varying dimming times with a set of three switches (8 settings). If you aren’t really interested in the “guts” of the code just:
- clone the files on github (here)
- add them to your project
- generate a bit-stream
- send the bit-stream to your FPGA
- play with your light
All of the blocks have their purposes commented within the code.
Step 5: Results
You should expect the LED on board the FPGA to start dimming after 50% of the dim time has passed. The timer will also reset every time a time switch is changed on the board or if the reset button is pressed.
The LED on the right is dimmer than the one on the left even though it may not look like it in the picture.
Step 6: Applications
This timing circuit can be used in other projects, and the dimming circuit can also be reused elsewhere. This circuit, as a whole, can be used to control things such as lighting in your home (with more hardware, of course). It can also act as a switch with a timed delay, with the use of some multiplexers. There are many more projects that can be built from this one and all you need it some time and creativity and you could be writing an instructable in no time.