Electronic – What microcontroller can connect directly to a USB port

microcontrollerusb

Essentially, I just need to send some data to the microcontroller via USB, then the microprocessor decodes the data and drives an LED light strip, which runs at 5V. I'm having trouble finding the right microcontroller for the job.

The microcontroller just needs to have 2 serial in ports for USB communication, two serial out ports for communication with the LED strip, and be able to operate at 5V. It seems unnecessary to have a dedicated IC for USB communication when all I need is a serial COM port set up.

For example, here is the snippet of Arduino code that writes a byte to the LPD8806 strip:

void write8(uint8_t d) {
  for (uint8_t i=0; i<8; i++) {
    if (d & _BV(7-i))
      digitalWrite(dataPin, HIGH);
    else
      digitalWrite(dataPin, LOW);
   digitalWrite(clockPin, HIGH);
   digitalWrite(clockPin, LOW); 
  }
}

To latch the data you send zeros to the strip.

Best Answer

I guess that by "two serial out ports" you mean one UART (since you also describe USB as 2 ports). Rocketmagmet indicates that many/most LED strings use SPI, but that will need at least 3 wires. Can you specify which protocol you need?

In general Microchip has the lowest cost microcontrollers, also this time. And Microchip has many microcontrollers in DIL package as well, while many others have ditched that. May be important for DIY. The PIC18F13K50

  • exists in both DIL-20 and SMT packages
  • works at 5 V (for interfacing with the LED strip)
  • is low cost at $2.5 (OK, that's relative, but USB able controllers are a bit more expensive than more basic types)
  • has Enhanced USART for UART interface
  • has an SPI interface in case you meant that
  • has 25 mA source and sink I/O, so you can directly drive a couple of indicator LEDs if needed

Further reading
USB Generic Function on an Embedded Device, Microchip Application Note AN1166

Related Topic