The project requirements are related to technologies adopted: high power LEDs need to be driven with a constant current; digital filters need a fast DSP engine, to be implemented, and an A/D converter is required to transform an audio signal in a numerical representation. Control data communications between central processing unit and external analog components require to have an SPI on board and, last but not least, the capability to link the system with a PC could be very useful for firmware debugging and for tuning some parameters in real time without needing expensive developing tools.
The dsPIC30F2020 perfect matches all these needs having a very powerful 4 channels independent PWM generator with current fail detection suitable for drive 3 LEDs in a buck booster configuration through two MOSFET drivers TC4427A a built-in 2Msps A/D converter and a DSP core featuring 17×17 bit multiplications for filters implementation; an SPI hardware for in-system communications; an RS232 compatible block useful for communications with an external PC.
The analog front-end such as anti-alias filter, fixed-factor amplifier and voltage references could be efficiently realized with rail to rail operational amplifiers such as the MCP608 and MCP6022. Automatic gain control could be implemented placing a MCP6S26 before the A/D converter block and changing his gain basing on input signal mean square averaged value calculated by the DSP.
Following the audio signal flow we can start to analyze the system from the electret microphone. The signal kept will be amplified and filtered by a 5th order low pass filter realized with an MCP608 and a MCP6022 (passive components selection and filter analysis was done with FilterLab© software). The resulting signal will be applied to the variable gain amplifier MCP6S26 and, then, to the A/D converter inside the dsPIC30F2020. From this point on, all following stages are implemented in digital domain. A first high pass filter is required to eliminate the DC residual (that could be present into the converted signal) then three filters are required to split audio in three components: low, mid and high bands. All digital filters were implemented as IIR filter with the dsPIC FD Lite© software
Filtered and unfiltered buffer signals are evaluated by a Signal Power Estimation routine that calculates four proportional values (three for the LEDs lighting and the fourth used to modify the gain of the external PGA). The three proportional values associated to the tree filtered bands are used to generate in software three 125Hz 16 level PWM. The output of this stage modulates three of the four available hardware PWM channels that, running at 150KHz, are suitable to drive external MOSFETs implementing the buck switching circuits.
Analog front-end subsystem: We would like to have a single power supply system referring to the ground level: this should be useful to reduce the number of electronic components to be used and, consequently, to reduce the size and the cost of the board. At the same time, the audio signal to be analyzed, captured by the microphone coupled in AC by a capacitor, is floating around the ground reference voltage. This is a problem for the A/D converter located in the dsPIC20F2020 that could easily handle signals over the ground reference but not under that. The electrical solution normally used to overcome this problem is to refer the signal to a “virtual ground” located at VDD/2. Virtual ground is implemented with an operational circuit in voltage follower configuration. The overall analog front end working point is referred to this virtual ground. Author: Marco Signorini
dsPIC30F2020 LED Psychedelic electronic projects files: dspic30f2020-led-psychedelic-tc4427a-mcp608-mcp6022-mcp6s26.RAR alternative link2 alternative link3