Modifications

Sauter à la navigation Sauter à la recherche
2 776 octets ajoutés ,  18 mars 2017 à 14:17
Ligne 69 : Ligne 69 :     
== Contrôler des NeoPixels avec SPI ==
 
== Contrôler des NeoPixels avec SPI ==
 +
One interesting use of the SPI protocol is driving the colors of WS2811/WS2812 NeoPixel addressable RGB LEDs.  These LEDs don't actually use SPI to communicate, instead they have a [https://learn.adafruit.com/adafruit-neopixel-uberguide/advanced-coding#writing-your-own-library very specific self-clocked signal] for sending pixel color bits.  However by using a high speed 6Mhz SPI signal we can 'oversample' the NeoPixel control signal and generate a close approximation of it from the D1 (MOSI) line of the FT232H.
    +
Note that this method of driving NeoPixels is limited to lighting about 340 pixels at a time.  This limitation comes from the maximum amount of data that can be sent to the FT232H at one time over the USB bus, about 64 kilobytes of data.  Because we're oversampling the NeoPixel control signal each pixel actually takes 24*8 bytes of SPI data (or one byte of SPI data for every bit of pixel data).
 +
 +
To demonstrate lighting NeoPixels with the FT232H breakout you'll need the following parts:
 +
* Assembled FT232H breakout board.
 +
* NeoPixel strip, strand, matrix, etc.
 +
** Remember at most you can only light about 340 pixels.
 +
* Strong 5 volt power supply to drive the NeoPixels. 
 +
** Each pixel can take up to 60mA, so driving more than a handful of pixels can quickly add up to a few amps or more of current. '''Do not try to power more than a couple NeoPixels over the FT232H 5V line!'''
 +
* Level converter chip to convert 3.3 to 5 volts '''OR''' a power diode that can handle the full power of all the NeoPixels.
 +
** The NeoPixel control signal needs to be at least 0.7*Vcc (power supply voltage) which is just a little too high for the 3.3 volt output of the FT232H breakout.  Just like [https://learn.adafruit.com/neopixels-on-raspberry-pi/wiring lighting NeoPixels with the Raspberry Pi] (''Adafruit, Anglais'') you need to either convert the control signal to 5 volts using a chip like the {{pl|1041|74AHCT125}}, or drop the NeoPixel power supply down slightly below 5 volts using a {{pl|46|power diode}}.
 +
* Jumper wires and breadboard.
 +
 +
In this example I'm lighting a 16 pixel ring so I'll use a power diode that can handle 1 amp of current.  If you're using more than 16 NeoPixels you'll want a larger power diode, or a level converter chip.
 +
 +
Connect the hardware as follows:
 +
* FT232H GND to power supply ground.
 +
* FT232H D1 (MOSI) to NeoPixel signal input.
 +
* Power supply positive voltage to diode anode (side without the stripe).
 +
* NeoPixel positive voltage to diode cathode (side with the stripe).
 +
* NeoPixel ground to power supply ground.
 +
 +
A picture of the hardware setup is below (note [[NeoPixel-UserGuide|I've added a large capacitor to the power supply as recommended in the NeoPixel Uberguide]]):
 +
 +
{{ADFImage|RASP-FT232H-MPSSE-Usage-SPI-00.jpg}}
    
{{RASP-FT232H-TRAILER}}
 
{{RASP-FT232H-TRAILER}}
29 917

modifications

Menu de navigation