scottlawsonbc / audio-reactive-led-strip

:musical_note: :rainbow: Real-time LED strip music visualization using Python and the ESP8266 or Raspberry Pi
MIT License
2.67k stars 642 forks source link

Adding arduino uno serial support #300

Open ygongdev opened 3 years ago

ygongdev commented 3 years ago

I'm a beginner in arduino, but since I had an arduino uno, which had no wifi, I decided to try a serial approach. Related to #52

Changes

  1. Altered the ws2812_controller_esp8266.ino code in arduino_serial.ino to use a buffer to store the serial data instead of udp data.
  2. After experimentation, I noticed that the buffer needs at least 16 bytes to pass the ledstrand test and can hold maximum of 64 bytes.
  3. Added serial support in led.py. Just need to match your serial port and baudrate
  4. Added arduino_serial to CONFIG.DEVICES
  5. I don't know how the FPS counter would work in the serial implementation so I left that out.

Problem I think the serial communication is way too slow for the visualization to work properly. The strip just seemingly lights up randomly. I'm guessing this is because every udp packet can send a lot more information about more pixels at faster rate than serial? However if someone can actually make this work, that would be cool. Just wanted to share my investigation @joeybab3 :)

joeybab3 commented 2 years ago

Sorry for the super late response, I'm glad to see a PR for this as I know it's been a long-requested feature!