0

Goal

My end goal is to have a NeoPixel LED Strip that I can control via software on my PC, with various automatic modes and manual control. Right now all I have is the idea and some research done, because I don't want to order parts if I can't get this working. That means no arduino, no leds, no power supply, and no experience with any of them.

What I know so far

I know enough Java to set up the software that would output some array of colors, including manual control and automatic modes like flashing/fading/etc.

From the research I've done, I'll need a microcontroller to make sure I output exactly the right signal(?) for my LED strip. Adafruit recommends an Arduino one or Arduino mega, which meet the timing requirements and have libraries available for use with NeoPixel products. Physically connecting the Arduino to the LED seems fairly easy.

What I don't know

Hardware and software wise, how can I transfer an array of color values from a java program to the Arduino?

This involves getting the data to a port on my PC, getting that to the Arduino via some wire/s, and making sure it's readable. I'd imagine sending an entire array to whatever input the arduino has would be difficult. Perhaps I could send a single color at a time together with an index, but that would probably add delay to the system.

On the software side, how do I set up the arduino to "forward" the input from my PC to the LED strip?

I'm not very comfortable with C, so this could be tough. How will I receive the data input? How easy and fast is it to turn that into output for the LED strip? What if I don't convert and output an update before I receive another one?

EDIT: It seems there are libraries available to deal with the actual data transfer, and encoding/decoding shouldn't be too hard after some thought. I think I'm going to use usb4java for communication between my PC and an Arduino, and roll my own mini "protocol" to convert. Then I'll use the NeoPixel libraries for the Arduino.

  • 1
    The standard solution is to have your PC software talk to the Arduino through the USB-tunneled serial port. You define the data format. The Arduino could decode that and use the NeoPixel library to drive the LED strip. – Edgar Bonet Sep 29 '16 at 18:58
  • You could calculate the maximum update rate you could get, if you are using serial communication between the Arduino and the PC (baubrate divided by the 24 times the number of pixels. That way you know if that's acceptable. Otherwise you'd have to add some more code to the Arduino to handle a more compressed form of data send to it. Command like e.g "all leds color X"; or "smooth transition from color X at pixel on, to color Y at the last pixel". – Gerben Sep 29 '16 at 19:04
  • @EdgarBonet I've looked around a bit and usb4java seems to deal with actually transferring the data, which just leaves the encoding and decoding. I think I could create a custom protocol to let me deal with a LED strip somewhat efficiently. Does that seem like a reasonable solution? – Spekular Sep 30 '16 at 18:28
  • I don't do Java, so I'm probably not qualified to answer this question. But I must say that the name “usb4java” looks suspicious. The Arduino is a USB CDC device. You normally let the OS handle the USB layers: from the application's point of view it's just a serial port. – Edgar Bonet Sep 30 '16 at 20:13
-2

You should take a look at FadeCandy if you are dealing with NeoPixel LED Strip. Ived used that in conjunction with Processing (which is JavaBased) to send stuff into a 16x16 NeoPixel display. (4 8x8 matrix's linked together) Fadecandy uses Open Pixel Control http://openpixelcontrol.org/

I've got an example of it on youtube... https://www.youtube.com/watch?v=rz_U4dzjp1s&feature=autoshare

  • This seems to focus a lot on images, based on the description and the Processing documentation I read, which isn't really what I want to do. It's a good suggestion though, so thanks! – Spekular Sep 30 '16 at 18:34

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.