Nicolas Electronics

Electronic projects and programming

Samples

Ping Google DNS with your PSVita

As I said in a previous post, I’ve contributed to some samples for the VITASDK.

This one is interesting to me as I’ve never used sockets before.
This sample is going to ping the Google DNS server 8.8.8.8.

I have to admit that I scratched my head for a while when trying to ping my laptop and not getting a response even though I saw the ping request in Wireshark.
An IRC (#henkaku & #vitasdk) user by the name of xyz told me to try to ping 8.8.8.8 and that the firewall in my laptop might be blocking the PSVita’s ping request.

He was right! I pinged 8.8.8.8 and I immediately got a reply… Stupid laptop…
(more…)

WS2812 LED driver on a 16F876A @20MHz

Someone on the matrix multimedia forum (French) needed to drive some WS2812 LEDs and wanted to use a 16F876A at 20MHz to do so.
The WS2812 LEDs are RGB LEDs with an integrated controller chip. There’s a data input and data output so you can cascade multiple LEDs by connecting DO to DI of the next LED. Each LED reads 3 bytes, being the value of the color green, red and blue.
Once you’ve sent a color to the LED, it will stay that color until you send another code.

Driving the LEDs would require timings in the 50ns/100ns range, but you can stretch it just a bit.
This is one of those things where timing is pretty much crucial and an AVR would be a better microcontroller for this as it executes one instruction per clock cycle where the PIC needs 4 clock cycles per instruction.
(more…)

Inverse Fourier Transform from a Forward Fourier Transform

I was given the idea to make an equalizer, or to at least try making one.
The way you make an equalizer is by taking some audio samples, use the FFT transformation on those samples then modify the amplitude of the FFT output at the desired frequencies and use those modified amplitudes as an input for an inverse FFT.
The output of the inverse FFT will give you a new set of samples that you can use and send to a DAC or other digital to analog converter.

(more…)

Sample code for the Fast Fourier Transform library

For those who would like to have a sample code for the FFT library, I’m going to attach a zip file containing the source code and code::blocks project file for you to try out.

The sample file will test an 8 point FFT on a signal containing two sine waves.
A sine wave of 1kHz with amplitude 1, phase 0° and another sine wave of 2kHz with amplitude 0.5, phase -45°.

(more…)