Author Topic: Choice of microcontroller or FPGA for DIY "Ambilight"  (Read 6515 times)

0 Members and 1 Guest are viewing this topic.

Offline Berni

  • Super Contributor
  • ***
  • Posts: 5017
  • Country: si
Re: Choice of microcontroller or FPGA for DIY "Ambilight"
« Reply #25 on: February 01, 2019, 06:47:24 am »
Well once you get past 720p resolution the old school parallel RGB bus seams to disappear because the clock rates start becoming so high.

But LVDS can be pretty nice for FPGA interfacing. It tends to use more pairs at higher resolutions so the clock speeds stay lower and you can often get away with a soft serdes on cheap FPGAs. And LVDS uses the standard serdes encoding schemes so the serdes block in the FPGA will know how to synchronize and decode it out of the box, spitting out raw RGB data out the other end. LVDS is also directly logic level compatible with FPGA pins (HDMI needs level shifting if you go by the book). With these high resolution displays i seen things like a dual 4 lane LVDS bus, this means 8 data diff pairs + clock. For 1080p 60Hz this brings the bitrate per lane to 500Mbit and its quite common to have 500 to 900Mbit soft serdes support in low end FPGAs.

Tho the nice simple LVDS interface is getting replaced nowadays with more complicated buses such as MIPI DSI or eDP.
 

Offline cobusve

  • Newbie
  • Posts: 4
  • Country: us
    • Micro Forum
Re: Choice of microcontroller or FPGA for DIY "Ambilight"
« Reply #26 on: February 01, 2019, 09:00:17 am »
I quite liked this approach

Back in the day I remember reverse engineering a video motion detection system which allowed you to select (using a mouse) regions on the tv and then detect motion in those areas. Yes seems trivial, the thing is this was implemented using a 8051 running at 10MHz!

The secret sauce was that they detected the H-sync and V-sync on a stadard PAL signal in hardware, and then used 2 GAL20V8's to generate a pixel clock, sample the image and generate a bit stream into the device representing a low-resolution pre-processed signal.

Using the approach above with a cheap PAL camera, or even just a couple of 1-pixel color sensors you could do a pretty interesting DYI implementation with pretty much any microcontroller you can buy today :)

You could e.g. for a crude version mount one of these https://www.digikey.com/product-detail/en/broadcom-limited/APDS-9160-003/516-4303-6-ND/9740445 at each corner of your TV and then use some WS2812's behind to match the colors interpolated between the corners ... That you can probably do with a little 8-bitter using only I2C and a couple of I/O pins.

Also take a look at https://www.microforum.cc/ - a great resource for information on PIC and AVR microcontrollers and embedded programming in general. You can also post questions to the experts there.
 

Offline Lunasix

  • Regular Contributor
  • *
  • Posts: 142
  • Country: fr
Re: Choice of microcontroller or FPGA for DIY "Ambilight"
« Reply #27 on: February 02, 2019, 05:37:25 pm »
I'm used to drive WS2812 with PIC32. I simply use SPI with DMA channel and a single level shifter to have 5V signal. In order to code 0 and 1 for WS2812, I simply use a spi clock 5x faster (4MHz), each WS2812 bit is then coded with 5 spi bits (10000 or 11100 for example), and the table is computed before DMA start. Each led (24bits) need 120 spi bits, but it's not a real problem for a PIC32 with a lot of RAM. The SCK io is not really used and SDI input is driven at the right level to have the wanted SDO level when no data is shifted out (SPI shift out SDI input). Tested with 40 WS2812.
On a PIC32MM, for which I had forgotten there was no DMA, I used normal SPI interrupt and it works well in that case because I have only 3 leds and a low refresh rate, 3 interrupts for 1 led would be too much in other cases, and you must prevent delay between 2 spi words (32bits) to prevent timing errors and then color errors.
« Last Edit: February 02, 2019, 05:49:31 pm by Lunasix »
 

Offline NorthGuy

  • Super Contributor
  • ***
  • Posts: 3237
  • Country: ca
Re: Choice of microcontroller or FPGA for DIY "Ambilight"
« Reply #28 on: February 02, 2019, 07:34:17 pm »
I simply use a spi clock 5x faster (4MHz), each WS2812 bit is then coded with 5 spi bits (10000 or 11100 for example), and the table is computed before DMA start.

For this timing, it's easier to use UART with inverted output. This way you need only 4 bits for one LED bit (one byte is needed to encode 2 LED bits). Two extra bits (start and stop bits) get emitted by UART automatically. This is easier to encode and takes less space.

 

Offline Lunasix

  • Regular Contributor
  • *
  • Posts: 142
  • Country: fr
Re: Choice of microcontroller or FPGA for DIY "Ambilight"
« Reply #29 on: February 02, 2019, 07:51:01 pm »
Good idea ! I will try. But without DMA (not advised), uart will need more interrupts as fifo is 8 x 8 for uart and 4 x 32 for spi. And calcul will be more efficient for UART... To be compared.
« Last Edit: February 02, 2019, 08:37:59 pm by Lunasix »
 

Online NiHaoMikeTopic starter

  • Super Contributor
  • ***
  • Posts: 9172
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: Choice of microcontroller or FPGA for DIY "Ambilight"
« Reply #30 on: February 02, 2019, 08:00:01 pm »
There also appears to be a way to do it with two PWM outputs set to the two required duty cycles, a SPI module synchronized to the PWM, and the CLC or external logic selecting the correct output based on what the SPI module is outputting.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 

Offline Lunasix

  • Regular Contributor
  • *
  • Posts: 142
  • Country: fr
Re: Choice of microcontroller or FPGA for DIY "Ambilight"
« Reply #31 on: February 02, 2019, 08:53:47 pm »
Yes, could be a better idea ! I will think about it.
 

Online NiHaoMikeTopic starter

  • Super Contributor
  • ***
  • Posts: 9172
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: Choice of microcontroller or FPGA for DIY "Ambilight"
« Reply #32 on: February 05, 2019, 12:54:22 am »
Surprise, surprise, Ben Heck just did a video about interfacing SPI to WS2812 LEDs!
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf